这个 MySQL 语句有什么问题?

发布于 2024-10-26 21:48:15 字数 739 浏览 0 评论 0原文

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心清如水 2024-11-02 21:48:15

Release 是一个关键字,反引号

$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 允许

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文