poleposters Posted May 28, 2008 Share Posted May 28, 2008 Hi, I keep getting a syntax error for the following query. I've been staring at it for ages and can't find it. I need a fresh pair of eyes to help me. $query="INSERT INTO details (details_id,business_id,display_name,hourly_rate,age,height,dress_size,bust_size,hair_colour,eye_colour,brazilian,background,body_type,natural) VALUES ('','69','$display_name','$hourly_rate','$age','$height','$dress_size','$bust_size','$hair_colour','$eye_colour','$brazilian','$heritage','$body_type','$natural')"; $result = mysql_query($query) or trigger_error("Query: $query \n<br />MySQL Error: " . mysql_error()); Also, is there a way to modify the query to provide a more comprehensive error report? This is the error An error occurred in script 'C:\xampp\htdocs\registrationratedr.php' on line 83: Query: INSERT INTO details (details_id,business_id,display_name,hourly_rate,age,height,dress_size,bust_size,hair_colour,eye_colour,brazilian,background,body_type,natural) VALUES ('','69','51','money','51','fs','15','15','15','15','1','15','1','15') MySQL Error: 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 'natural) VALUES ('','69','51','money','51','fs','15','15','15','15','1','15','1'' at line 1 It doesn't really help me much. Quote Link to comment Share on other sites More sharing options...
prcollin Posted May 28, 2008 Share Posted May 28, 2008 i dont know but try spacing out the inputs and putting single quotes like ('input', 'input2') im fairly new but that seemed to help me in a previous project Quote Link to comment Share on other sites More sharing options...
jonsjava Posted May 28, 2008 Share Posted May 28, 2008 $query="INSERT INTO details (`details_id`, `business_id`, `display_name`, `hourly_rate`, `age,height`, `dress_size`, `bust_size`, `hair_colour`, `eye_colour`, `brazilian`, `background`, `body_type`, `natural`) VALUES ('', '69', '$display_name', '$hourly_rate', '$age', '$height', '$dress_size', '$bust_size', '$hair_colour', '$eye_colour', '$brazilian', '$heritage', '$body_type', '$natural')"; $result = mysql_query($query) or trigger_error("Query: $query \n<br />MySQL Error: " . mysql_error()); made it easier to read, and added "`" Quote Link to comment Share on other sites More sharing options...
gizmola Posted May 28, 2008 Share Posted May 28, 2008 Please post a describe for the details table. Quote Link to comment Share on other sites More sharing options...
poleposters Posted May 28, 2008 Author Share Posted May 28, 2008 Thanks Gizmola, The problem was with the table. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.