kobescoresagain
04-01-2006, 12:37 AM
Okay here is the table layout
id int(8) No 0
name varchar(50) Yes NULL
dob varchar(50) Yes NULL
height varchar(50) Yes NULL
weight int(3) Yes 0
jersey varchar(50) Yes NULL
from varchar(50) Yes NULL
position varchar(50) Yes NULL
teamname varchar(50) Yes NULL
sport varchar(25) Yes NULL
Here is the mysql query
$query = "INSERT INTO add_temp_player (id, name, height, weight, jersey, from, position, teamname, sport) VALUES ($_POST[id2],'$_POST[name]','$_POST[height]',$_POST[weight],'$_POST[number]','$_POST[from]','$_POST[position]','$_POST[team]','$_POST[sport]')";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
When I echo out the $query I get this
INSERT INTO add_temp_player (id, name, height, weight, jersey, from, position, teamname, sport) VALUES (59,'Larry Hughes',' 6-5',184,' 32',' St. Louis',' G','cavaliers','')
Here is the error
Query failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'from, position, teamname, sport) VALUES (591,'Luis Alicea','',0
The database is connected, because the other queries, on the same page work.
Which looks right to me. I am not sure why it isn't working, can anyone help me out.
Thanks
id int(8) No 0
name varchar(50) Yes NULL
dob varchar(50) Yes NULL
height varchar(50) Yes NULL
weight int(3) Yes 0
jersey varchar(50) Yes NULL
from varchar(50) Yes NULL
position varchar(50) Yes NULL
teamname varchar(50) Yes NULL
sport varchar(25) Yes NULL
Here is the mysql query
$query = "INSERT INTO add_temp_player (id, name, height, weight, jersey, from, position, teamname, sport) VALUES ($_POST[id2],'$_POST[name]','$_POST[height]',$_POST[weight],'$_POST[number]','$_POST[from]','$_POST[position]','$_POST[team]','$_POST[sport]')";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
When I echo out the $query I get this
INSERT INTO add_temp_player (id, name, height, weight, jersey, from, position, teamname, sport) VALUES (59,'Larry Hughes',' 6-5',184,' 32',' St. Louis',' G','cavaliers','')
Here is the error
Query failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'from, position, teamname, sport) VALUES (591,'Luis Alicea','',0
The database is connected, because the other queries, on the same page work.
Which looks right to me. I am not sure why it isn't working, can anyone help me out.
Thanks