Solved: Increment a number in database
Posted: Fri Mar 14, 2014 1:51 pm
Hi,
I want to update a number in a database each time with 1.
Now I first do a Select to get the old number.
and than update with the new number.
Is there a faster way?
I want to update a number in a database each time with 1.
Now I first do a Select to get the old number.
and than update with the new number.
Code: Select all
SELECT num FROM database WHERE id='x';
$newnum=$oldnum+1;
UDPATE database set num='$oldnum' WHERE id='x';