duanjiu6697 2015-04-29 13:43
浏览 47

请检查此SQL查询是否正确

I am trying to update the data in a row of a table which by specific user ID. But I am receiving syntax error. Could anyone tell me what's the wrong in the syntax or I miss something ?

Result of an echo statement --->

UPDATE activitymeter SET totaltimes = 4, tna_wd = 1, tnm_wd = 10, tna_we = 10, tnm_we = 10, mvpa_wd = 2, mvpa_we = 5, week_diff = -3, tailor_advice= Your weekday activity level is below the recommended levels but it looks as though this is improved on a weekend. WHERE user_id = 2227904 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'weekday activity level is below the recommended levels but it looks as though th' at line 10

  • 写回答

2条回答 默认 最新

  • dongye9820 2015-04-29 14:01
    关注

    I always use more complete syntax (include all back-ticks for table names, etc) like so:

    $intotable = "UPDATE `activitymeter` SET `update_totaltimes` = '".$totalactivity."', `update_tna_wd` = '".$timeweekday."', `update_tnm_wd` = '".$totalweekday."', `update_tna_we` = '".$timeweekend."', `update_tnm_we` = '".$totalweekend."', `update_mvpa_wd` = '".$mvpaweekday."', `update_mvpa_we` = '".$mvpaweekend."', `update_week_diff` = '".$dayenddifference."', `update_tailor_advice` = '".$tailoradvice."', `timestamp_column` = '".$tsnow."' WHERE `user_id` = '".$userid."';";
    
    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制