Jump to content

I need fresh eyes to help fix this INSERT error.


poleposters

Recommended Posts

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.

$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 "`"

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.