Jump to content

SQL error #1064


Stromgren

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 :)

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...