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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.