Jump to content

SQL error #1064


Stromgren
 Share

Recommended Posts

Hello I have a problem with a query i just created. When i run it, it returns this error: #1064 - 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 '"INSERT INTO user (username, password, join_date, virksomhed, email, vej, postnu' at line 1

"INSERT INTO user (username, password, join_date, virksomhed, email, vej, postnummer, by, telefon) VALUES ('$username', SHA('$password1'), NOW(), '$virksomhed', '$email', '$vej', '$postnummer', '$by', '$telefon')"

Can anyone please help me? Thanks in advance :)

  • Like 1
Link to comment
Share on other sites

Thanks for the reply.. The double quotes and variables is showing because i copied from the PHP variable containing the query. It looks like this:

$query = "INSERT INTO user (username, password, join_date, virksomhed, email, vej, postnummer, by, telefon) VALUES ('$username', SHA('$password1'), NOW(), '$virksomhed', '$email', '$vej', '$postnummer', '$by', '$telefon')";

This still won't work for me.

Link to comment
Share on other sites

The original error message showed the double quote as part of the query, maybe you pasted that into phpMyAdmin or something and copied too much. The error message showed this as the query: '"INSERT INTO user (username, password, join_date, virksomhed, email, vej, postnu' If you remove the single quotes surrounding that, you're left with this: "INSERT INTO user (username, password, join_date, virksomhed, email, vej, postnu So it was seeing the double quote as part of the SQL. If it was flagging "by" as the problem it would have started the query with that, e.g.: #1064 - 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 'by, telefon) VALUES (...' at line 1 The first thing that it shows in the query in the error is usually the part that it had the problem with.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...