$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