Re-order mysql rows using PHP

Posted by dave e on Stack Overflow See other posts from Stack Overflow or by dave e
Published on 2010-05-25T21:53:02Z Indexed on 2010/05/25 22:11 UTC
Read the original article Hit count: 252

Filed under:
|
|
| id  | url    | title  | menu_id |
------+--------+--------+----------
| 1   | http://| link 1 | 1       |
| 2   | http://| link 2 | 2       |
| 3   | http://| link 3 | 3       |
| 4   | http://| link 4 | 4       |

Hi, I was wondering if its possible using PHP to reorder the above to something like below. I am trying to generate a menu which can easily be reordered by clicking an up or down arrow. I have no idea where to start. Any help would be much appreciated.

| id  | url    | title  | menu_id |
------+--------+--------+----------
| 1   | http://| link 1 | 2       |
| 2   | http://| link 2 | 4       |
| 3   | http://| link 3 | 3       |
| 4   | http://| link 4 | 1       |

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql