esoteric Posted November 7, 2011 Share Posted November 7, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/250630-insert-error/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 7, 2011 Share Posted November 7, 2011 The error is in your list of column names, they have quotes around each of them, making them string data values instead of column names. Quote Link to comment https://forums.phpfreaks.com/topic/250630-insert-error/#findComment-1285914 Share on other sites More sharing options...
litebearer Posted November 7, 2011 Share Posted November 7, 2011 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; Quote Link to comment https://forums.phpfreaks.com/topic/250630-insert-error/#findComment-1285925 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.