www.webdeveloper.com
Results 1 to 3 of 3

Thread: update query in simple table

  1. #1
    Join Date
    Jun 2009
    Posts
    56

    update query in simple table

    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

  2. #2
    Join Date
    Jun 2008
    Posts
    62
    Code:
    START TRANSACTION;
      UPDATE menureg SET order=order+1 WHERE menuid=id1;
      UPDATE menureg SET order=order-1 WHERE menuid=id2;
    COMMIT;

  3. #3
    Join Date
    Jun 2009
    Posts
    56
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles