Jump to content

swapping display_order numbers (moving up and down)


stijn0713

Recommended Posts

Hello, i try to move a record with position 3 up, so record with position 3 becomes record with position 2 and 2 becomes 3.

 

i try this but it doesn't seems to work:

 

mysql_query("UPDATE poll_questions SET position = 
  CASE position 
    WHEN 2 THEN 3
    WHEN 3 THEN 2
  END CASE 
WHERE position BETWEEN 2 AND 3"); 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.