如果我正確讀取PHP文檔,我想使用mysqli_stmt_init來創建適合stmt操作的變量是否正確?我以爲我做得正確,但似乎沒有正常工作。當我這樣做的文件說,它給了我一個錯誤:MySQLI語句(stmt)初始化錯誤
警告:mysqli_stmt_bind_param()[function.mysqli-語句綁定 - PARAM]:無效的對象或資源mysqli_stm」
$get_posts = mysqli_stmt_init($db);
mysqli_stmt_prepare($get_posts, 'select * from Chatposts where Chatid = ? and and CPid > ? and Deleted = ? order by CPid desc limit ?');
mysqli_stmt_bind_param($get_posts, 'iiii', $chatroomid, $lastpost, $deleted, $limit);
mysqli_stmt_execute($get_posts);
mysqli_stmt_bind_result($get_posts, $newposts);
mysqli_stmt_fetch($get_posts);
mysqli_stmt_close($get_posts);
你能看見?
? and and CPid
因此返回:我做了什麼錯在這裏
'和和CPid>?'太多了'和'。 – 2013-03-14 00:51:20
使用'if(!$ get_posts)echo mysqli_error($ db)進行錯誤檢查;' – 2013-03-14 00:52:16
好吧,它看起來是太多了,謝謝! – Rujikin 2013-03-14 00:54:34