$sth->execute(array(':calories' => $calories, ':colour' => $colour));
另从here:
/*** reassign the variables again ***/
$data = array('animal_id'=>4, 'animal_name' => 'bruce');
/*** execute the prepared statement ***/
$stmt->execute($data);
我的问题是::key
或key
?
对不起,我没有在这里的PHP环境。
你确认了吗? – Gtker 2010-04-20 14:00:28
是的,但我更喜欢http://www.php.net/manual/en/pdostatement.bindparam.php @Macmade写了重要的答案,您应该阅读。 – 2010-04-20 14:15:29
如果变量是用保留关键字命名的,你能详细说明那个错误吗? – Gtker 2010-04-20 14:30:04