我嘗試用準備好的發言首次運行到以下問題與下面的代碼PHP的MySQL綁定PARAM參數
錯誤:
警告:mysqli_stmt_bind_param()預計參數1要 mysqli_stmt,布爾給
代碼:
$stmt = mysqli_prepare($db, "INSERT INTO fragrances(name, description, essentialoils, topnotes, middlenotes, basenotes, reference, year, type, price, fragrancehouse, triangle, extractname, extractreference, extractprice, extractfragrancehouse, disccolour, collarcolour, actuatorcolour)
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
mysqli_stmt_bind_param($stmt, 'sssssssssssssssssss', $name, $description, $essentialoils, $topnotes, $middlenotes, $basenotes, $reference, $year, $type, $price, $fragrancehouse, $triangle, $extractname, $extractreference, $extractprice, $extractfragrancehouse, $disccolour, $collarcolour, $actuatorcolour);
mysqli_stmt_execute($stmt);
我在這裏看過很多不同的問題,他們的解決方案似乎都不適用於我的問題,有誰知道這個問題是什麼?
筆記,我所有的瓦爾都是字符串
感謝
準備失敗。你需要得到'mysqli_error'的輸出。您的查詢中也沒有佔位符。如果mysqli支持使用'?'或命名參數(我不確定) – Cfreak 2014-10-10 20:06:42