Joe
Joe

Reputation: 457

PHP mySQL INSERT syntax error?

I'm a newbie and I've been trying for over an hour to solve this simple query:

mysql_query("INSERT INTO `tracks` (artistID, albumID, format, trackID, niceTitle, title, trackNumber, description, pictureURL, playCount) VALUES('$artistID', '$albumID[$i]', 'hq','$ID[0]', '$trackName', '$title', '$j', '$description', '$pictureURL', '$playCount'") or die(mysql_error());

I just get this error every time:

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 1

I've done mysql_escape_string() on all variables too. Any ideas?

Upvotes: 0

Views: 61

Answers (2)

nicolas
nicolas

Reputation: 719

You have no ending parenthesis ")" in your query

Upvotes: 2

Tim Fountain
Tim Fountain

Reputation: 33148

You are missing the final closing ):

mysql_query("INSERT INTO `tracks` (artistID, albumID, format, trackID, niceTitle, title, trackNumber, description, pictureURL, playCount) VALUES('$artistID', '$albumID[$i]', 'hq','$ID[0]', '$trackName', '$title', '$j', '$description', '$pictureURL', '$playCount')") or die(mysql_error());

Upvotes: 7

Related Questions