我有个小问题。我尝试使用AutoExecute执行几个查询:
$rows = array(
array(
"text" => md5(rand(1,999)),
"value" => rand(1,999)
),
array(
"text" => md5(rand(1,999)),
"value" => rand(1,999)
),
array(
"text" => md5(rand(1,999)),
"value" => rand(1,999)
)
/* [... and 10 more ...] */
);
foreach ($rows as $row)
{
if ($db->AutoExecute("sometable", $row, "INSERT"))
{
echo "Done";
}
else
{
echo "Error";
}
}
?>我得到了错误代码5。如何使用Adodb和AutoExecute处理多个查询?
发布于 2016-11-08 17:12:13
如https://github.com/ADOdb/ADOdb/issues/286中所述
autoExecute()只处理一条记录。尝试使用
foreach($sql as $row) {
$db->autoExecute('test', $row, 'INSERT');
}顺便说一句,由于autoExecute()的开销,使用预准备语句可能更有效。
https://stackoverflow.com/questions/40359643
复制相似问题