[thelist] [mysql] + operator

Anthony Baratta Anthony at Baratta.com
Sun Feb 2 18:56:47 CST 2003


At 04:34 PM 2/2/2003, Paul Bennett wrote:
>ok, I have a numeric field in a database and I want to update it with
>another numeric value, so the new data represents the total of the old
>plus the new:
>$sql = "update $tableName set hours=hours+'$newValue' where id='$id'
>limit 1";
>this is currently not working - the query executes fine, but the row is
>not updated. I am guessing it is something to do with my syntax, as I am
>unfamiliar with addition operation within a mysql query.

Drop the Limit directive. And are you sure your ID number exists in the DB
or is the correct one?
---
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."




More information about the thelist mailing list