Jump to content

[SOLVED] Correct Syntax


cheechm

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

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.