Click to See Complete Forum and Search --> : update query in simple table


prathikanoe
07-13-2009, 02:07 AM
hi.. i need help in update query..i want to update the table rows , the data is comng from database ,i used php for that. db is mysql.. according to my requirement i want to use two buttions for move up and move down , both should take place simutaneously. when i press move up button, one value should go up nd that correspondng value should move down. so for that i neeed to write a update query in the same table.. is it possible to write two update queries in same table.. it looks silly question.. but some one help me..

my querys is:

update menureg set order=order+1 where menuid=id..
and other query update menureg set order=order-1 where menuid=id..

please help me. both should take place togeher..

cheers
prathi

Malgrim
07-13-2009, 03:28 AM
START TRANSACTION;
UPDATE menureg SET order=order+1 WHERE menuid=id1;
UPDATE menureg SET order=order-1 WHERE menuid=id2;
COMMIT;

prathikanoe
07-13-2009, 03:44 AM
ok.. thanks for the reply but how to implement it with php. i mean i am askng bout the execution..bcoz exection is important wth mysql_query