【问题标题】:PDO is not liking my queryPDO 不喜欢我的查询
【发布时间】:2017-11-21 11:45:41
【问题描述】:

所以我有以下准备好的查询:

INSERT INTO messages (email,receiver,name,message,created_at,batch_id) VALUES (:email, :receiver, :name, :message, :created_at, (SELECT main_table.batch_id FROM batch_id AS main_table))

执行此操作时,会创建一条新记录,但 batch_id 应该为 1 时始终为 0。

所以我调试了 stmt,它返回了以下发送的查询:

INSERT INTO messages (email,receiver,name,message,created_at,batch_id) VALUES ('jmy@email.com', 'My name', 'Not my name', 'My message to not my name', '2017-11-21 12:33:07', (SELECT main_table.batch_id FROM batch_id AS main_table))

查询看起来不错,当我在 Sequel Pro 中手动执行时,batch_id 应该是 1。

为什么 PDO 没有做它应该做的事情?

【问题讨论】:

标签: mysql pdo


【解决方案1】:

某个地方潜入了一个更新查询,它弄乱了数据。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-25
    • 2014-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-23
    • 2012-09-18
    • 1970-01-01
    相关资源
    最近更新 更多