Hey Guys I'm getting a syntax error with my SQL
on my PHP
page.
Basically what my page does is that it simply inserts data from a form and inserts into the database.
This is my code and my error:
Problem with query.
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 '', '', '', '', '', '')' at line 2
$sql = "INSERT INTO user (username, password, gname, mname, surname, address, state, postcode, tel)
VALUES ( '$usernamestr', '$passwordstr','$firstnamestr', '$middlenamestr’, '$familynamestr', '$addressstr', '$statestr', '$postcodestr', '$phonestr');";
$rs = mysql_query($sql, $conn)
or die ('Problem with query' . mysql_error());
I thought this was the way to do it? which is absolutely weird.
You have a funky quote:
VALUES ( '$usernamestr', '$passwordstr','$firstnamestr', '$middlenamestr’, '$familynamestr',
^^^^
HERE
It is a ’
and needs to be a '
(as the syntax highlighter shows in my answer but not in your question).
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments