Jump to content

insert error


esoteric

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
https://forums.phpfreaks.com/topic/250630-insert-error/
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
https://forums.phpfreaks.com/topic/250630-insert-error/#findComment-1285925
Share on other sites

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.