【发布时间】:2016-08-09 10:20:23
【问题描述】:
无法弄清楚为什么这段代码不起作用:
$update_SQL = $db->prepare($SQL_update);
$update_SQL->execute([$SQL_values]);
这些是插入到这些语句中的两个字符串的转储:
$SQL_update = UPDATE laptops SET asset_tag = :asset_tag WHERE id = :id
$SQL_values = 'asset_tag' => 5544, 'id' => 23
【问题讨论】:
-
$update_SQL->execute([':asset_tag' => 5544, ':id' => 23]);并检查 .:是否错过 -
可能是旧版本的 php 不支持 []。所以试试: $update_SQL->execute(array('asset_tag' => 5544, 'id' => 23));