cheechm Posted May 9, 2008 Share Posted May 9, 2008 'UPDATE site_menu SET `order` = ' . $row['order']+1 . ' WHERE `order` < ' .$order . ' AND id != ' . $menu_id; What is the correct syntax for $row['order']+1? Thanks EDIT: Full code $order = 1; if ($action == 'move_up') { $sql = 'SELECT * FROM site_menu ORDER BY `order` DESC LIMIT 0,1'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $osql = 'UPDATE site_menu SET `order` = ' . $row['order']+1 . ' WHERE `order` < ' .$order . ' AND id != ' . $menu_id; $oresult = $db->sql_query($osql); $rsql = 'UPDATE site_menu SET `order` = ' . $order . ' WHERE id = ' . $menu_id; $rresult = $db->sql_query($rsql); $db->sql_freeresult($rresult); $db->sql_freeresult($oresult); $db->sql_freeresult($result); } Quote Link to comment https://forums.phpfreaks.com/topic/104932-solved-correct-syntax/ Share on other sites More sharing options...
marklarah Posted May 9, 2008 Share Posted May 9, 2008 Okay, don't use row['... It hurts mysql... Now try this: $update_order = $row['order']+1; "UPDATE site_menu SET `order` = '$update_order' WHERE `order` < '$order' AND id != '$menu_id"; Quote Link to comment https://forums.phpfreaks.com/topic/104932-solved-correct-syntax/#findComment-537127 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.