这个MySQL语句有什么问题?

时间:2011-03-25 22:54:31

标签: php mysql sql sql-update

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

$my是一个包含许多其他mysql命令的自定义类。为了证明它工作正常,它适用于以下查询:

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

1 个答案:

答案 0 :(得分:4)

发布是一个关键字,反击它

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

注意:

  1. release_date =''将其设置为无效日期标记'0000-00-00'
  2. 请不要引用数字,即使MySQL允许你