0
我試圖創建一個使用從以前的頁面發佈數據的INSERT語句,並將其綁定到聲明錯誤綁定參數在PHP /庫MySQLi
我的SQL INSERT語句是這樣的:
// insert new user
$db = createConnection();
$insertquery="insert into comments (com, userid, comdate, blogpost) values (?,?,?,?)";
$inst=$db->prepare($insertquery);
$inst->bind_param("sisi", $comment, $user, $today, $id);
$inst->execute();
$inst->close();
當我打開調試PHP這是錯誤我收到
Fatal error: Call to a member function bind_param() on boolean in /blog/xcomment.php on line 29
正在傳遞中的bind_param的數據
Array ([comment] => My New Comment [blogid] => 1) 2016-01-07 12:31:50
$user = $currentuser['userlevel'];
$comment = $_POST['comment'];
$id = $_POST['blogid'];
$today = date("Y-m-d H:i:s");