2
votes

I get the following error when running my .php file:

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 ''feeds_list' SET 'cron' = now() WHERE 'feed_id' = '1'' at line 1

Here is the code:

$sql = mysql_query("UPDATE 'feeds_list' SET 'cron' = now() WHERE 'feed_id' = '$feed_id'") or die (mysql_error());

Thanks for helping me out

3
Try this one $sql = mysql_query("UPDATE 'feeds_list' SET cron = now() WHERE feed_id = '$feed_id'") or die (mysql_error()); - Nipun Tyagi

3 Answers

5
votes

Remove the '' around table names and column names, it should be:

UPDATE feeds_list SET cron = now() WHERE feed_id = '$feed_id'

or use a backticks (``).

2
votes
$sql = mysql_query("UPDATE feeds_list SET cron = now() WHERE feed_id = '$feed_id'") or die (mysql_error());

USE cron Not 'cron'

0
votes

if you are putting single quotes on the field name it will show error, don't get confused in single quotes and backticks they are completely different.