Jump to content

insert error


esoteric
 Share

Recommended Posts

Can anyone see something wrong with this? It's driving me crazy and throwing up an 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 ''user_name', 'user_email', 'user_credit', 'fname', 'lname', 'hous' at line 3

 

$sql_insert = ("INSERT INTO users
  			(
		'user_name',
		'user_email',
		'user_credit',
		'fname',
		'lname',
		'house_num',
		'addr',
		'addr2',
		'county',
		'postcode',
		'pwd',
		'dobDay',
		'dobMonth',
		'dobYear',
		'tel',
		'date',
		'users_ip',
		'avatar'
		)
	    VALUES
	    (
		'".$user_name."',
		'".$usr_email."',
		'0.00',
		'".$fname."',
		'".$lname."',
		'".$house_num."',
		'".$addr."',
		'".$addr2."',
		'".$county."',
		'".$postcode."',
		'".$sha1pass."',
		'".$dobDay."',
		'".$dobMonth."',
		'".$dobYear."',
		'".$tel."',
		'".$date."',
		'".$user_ip."',
		'/images/default/avatar.png'
		)");
		echo $sql_insert;
mysql_query($sql_insert,$link) or die(mysql_error());

 

I can't see what i wrong with it, i removed all the blank entries (ones with the value 'null',) but it didn't make any difference

Link to comment
Share on other sites

As per PFM...

$sql_insert = "INSERT INTO users (user_name, user_email, user_credit, fname, lname, house_num, addr, addr2, county, postcode, pwd, dobDay, dobMonth, dobYear, tel, date, users_ip, avatar)  VALUES('$user_name', '$usr_email', '0', '$fname', '$lname', '$house_num', '$addr', '$addr2', '$county', '$postcode', '$sha1pass', '$dobDay', '$dobMonth', '$dobYear', '$tel', '$date', '$user_ip', '/images/default/avatar.png'";

echo $sql_insert;

Link to comment
Share on other sites

This thread is more than a year old.

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.

 Share

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