Order of queries in mysql

wxdqz

New Member
I am having trouble with a script, here it is

$value = mysql_fetch_array($result);

if ($value >= 0)
mysql_query("UPDATE table SET field=field-1);

the problem is that if the server is slow and someone loads the page twice then the UPDATE query gets executed twice... because $value doesn't get updated inmediately then I decrease 'field' two times.
 
Back
Top