Jump to content

Recommended Posts

'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);

                        }

Link to comment
https://forums.phpfreaks.com/topic/104932-solved-correct-syntax/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.