dro7152 2011-05-23 11:03
浏览 165
已采纳

无法使用PHP在MySql中插入数据

Here's my insert query.

$insertQuery = "INSERT INTO timeline (id_str, from_user, text, timestamp, location) VALUES ($resultsAry[$x]['id_str'], $resultsAry[$x]['from_user'], $resultsAry[$x]['text'], $datetime, $locationAry[$i]['place'])";

The values passing to the query seem correct (Checked by echo-ing all the values). But I got the following error.

Insert failed: 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 '['id_str'], Array['from_user'], Array['text'], 2011-05-23 18:58:27, Array['place' at line 1

Please help?

  • 写回答

3条回答 默认 最新

  • dsjlqkbpn029473708 2011-05-23 11:07
    关注

    try this:

    $insertQuery = "INSERT INTO timeline (id_str, from_user, text, timestamp, location) VALUES ('".$resultsAry[$x]['id_str']."', '".$resultsAry[$x]['from_user']."', '".$resultsAry[$x]['text']."', '".$datetime."', '".$locationAry[$i]['place']."')";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作