Jump to content

Error in SQL syntax?


refiking

Recommended Posts

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 '21'' at line 1

 

I am trying to update the db by team name.  Each team is a field on the db.  So, how can I fix this error message?

 

Here is the code:

mysql_query("UPDATE davt SET $tm = '' WHERE lid = '$lid' AND sid = '$sid'")or die(mysql_error());
mysql_query("UPDATE davt SET $tm = '$owner' WHERE lid = '$lid AND sid = '$sid'")or die(mysql_error());

Link to comment
https://forums.phpfreaks.com/topic/100009-error-in-sql-syntax/
Share on other sites

mysql_query("UPDATE davt SET $tm = '' WHERE lid = '$lid' AND sid = '$sid'")or die(mysql_error());
mysql_query("UPDATE davt SET $tm = '$owner' WHERE lid = '$lid' AND sid = '$sid'")or die(mysql_error());

you forgot to close off, on the second line lid = '$lid'

it was just lid = '$lid AND sid = ect...

 

that should fix the error!

 

Your Welcome,

Zack

Link to comment
https://forums.phpfreaks.com/topic/100009-error-in-sql-syntax/#findComment-511419
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.