I’m trying to query an entry that has the lowest number value and then update the number value to value +1 in the database as follows:
$ras = db_query("SELECT name,number FROM {people} ORDER BY number DESC LIMIT 1");
$raw = db_fetch_array($ras);
$com_name = $raw['name'];
$count = $raw['number']+1;
db_query("UPDATE {people} (number) SET ('%d') WHERE name='%s'", $count, $com_name);
I get an error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use. What’s wrong here?
Your
SETclause is wrong.Try this:
or this, (if your
numbercolumn isINTtype:NOTICE the removed quotes?