esm
02-13-2008, 12:22 PM
fortunately (for me), most of my interaction with sql is simple queries (selects, updates, deletes). but i do have one statement that I have a question about
the code is$query="UPDATE mytable SET counter=counter+$number WHERE account=$account";
sometimes $number is positive and sometimes it is negative.
the PHP code then (sometimes) evaluates to$query="UPDATE mytable SET counter=counter+-1 WHERE account=1234";
so, my question is: Is "counter+-1" acceptable in mySQL...??? it seems to work. just looks strange.
.
the code is$query="UPDATE mytable SET counter=counter+$number WHERE account=$account";
sometimes $number is positive and sometimes it is negative.
the PHP code then (sometimes) evaluates to$query="UPDATE mytable SET counter=counter+-1 WHERE account=1234";
so, my question is: Is "counter+-1" acceptable in mySQL...??? it seems to work. just looks strange.
.