Like when i have to increment a value in a certain row, I now do one SELECT statement, Then fetch_row and finally an UPDATE statement.
It looks like this
$res=mysql_query("SELECT field FROM table USE INDEX ( id ) WHERE id=$id");
$row=mysql_fetch_row($res);
$val=$row[0]+1;
mysql_query("UPDATE table SET field='$val' USE INDEX ( id )WHERE id=$id");
So i'm searching it twice, Once in the SELECT and once in the UPDATE. Is there a way i can make the UPDATE statement use the result from the SELECT statement?