stijn0713 Posted August 13, 2012 Share Posted August 13, 2012 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"); Link to comment https://forums.phpfreaks.com/topic/267009-swapping-display_order-numbers-moving-up-and-down/ Share on other sites More sharing options...
Barand Posted August 13, 2012 Share Posted August 13, 2012 "END CASE" should just be "END" Link to comment https://forums.phpfreaks.com/topic/267009-swapping-display_order-numbers-moving-up-and-down/#findComment-1368968 Share on other sites More sharing options...
fenway Posted August 20, 2012 Share Posted August 20, 2012 And SQL would have produced a syntax error -- which clearly wasn't checked. Link to comment https://forums.phpfreaks.com/topic/267009-swapping-display_order-numbers-moving-up-and-down/#findComment-1370975 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.