Hi,
I am working with PHP 5 and MYSQL (most current version, although Im not sure of the number of the top of my head). My problem is this...
I would like to update TWO DB fields at once... Right now, I have this:
$mystatement="UPDATE mytable SET myfield1=myfield1+1 WHERE ID='id_number'";
Now... This works just fine and updates "myfield1" by adding 1(incrementing) to the current myfield1 value. BUT... In my script, I will occasionally be resetting the "myfield1" value to ZERO, BUT I would still like to track the total from it, in another field -- "myfield2".
Is there a statment that will allow me to update (increment) both myfield1 and myfield2 at the same time? Something like...
$mystatement="UPDATE mytable SET myfield1=myfield1+1 AND SET myfield2=myfield2+1 WHERE ID='id_number'";
Please help, thanks.
2006-12-23
07:58:21
·
4 answers
·
asked by
Player 1
2
in
Programming & Design