开发者

What is wrong with this MySQL statement?

开发者 https://www.devze.com 2023-02-20 01:55 出处:网络
$my->query(\"UPDATE ideas SET category = \'Document Options\', category_id = \'4\', status = \'Released\',
$my->query("UPDATE ideas 
               SET category = 'Document Options', 
                   category_id = '4',
                   status = 'Released',
                   status_id = '3', 
                   title = 'Support for iPad', 
                   idea = 'Add support for iPad. Allow uploads and downloads via the anonymous App for iPhone and iPad.', 
                   release = 开发者_Python百科'0',
                   release_date = ''
             WHERE id = '225'");

$my is a custom class which contains a lot of other mysql commands. To prove it works fine it works great for the following query:

$my->query("UPDATE idea_feedback
               SET Feedback = '$feedback',
                   Date = '$fdate' 
             WHERE ID = '$i'");


Release is a keyword, backtick it

$my->query("UPDATE ideas SET category='Document Options', category_id='4',
            status='Released', status_id='3', title='Support for iPad',
            idea='Add support for iPad. Allow uploads and downloads via the anonymous App for iPhone and iPad.',
            `release`='0', release_date='' WHERE id='225'");

Notes:

  1. release_date='' set it to the invalid date marker '0000-00-00'
  2. please don't quote numbers, even if MySQL allows you to
0

精彩评论

暂无评论...
验证码 换一张
取 消