我正在使用Zend db更新MySQL表中的记录。我有一个获取uuid的SELECT;然后执行以下命令来更新相同的记录:
$data = array(
'fieldname' => 'foobar',
);
$where = array();
$where["uuid = ?"] = $uuid;
$db->update('customers', $data, $where);不幸的是,记录没有更新,并且我没有收到错误消息。uuid正确。
发布于 2018-06-26 07:44:55
我想我错过了行刑。我最终做了这样的事情:
$update = $db->update('customers');
$update->where(['uuid' => $uuid]);
$update->set(['fieldname' => 'foobar']);
$statement = $db->prepareStatementForSqlObject($update);
$results = $statement->execute();这样做效果很好。
https://stackoverflow.com/questions/51025338
复制相似问题