function addAlbum($album){
$connection = mysqli_connect(HOST,USER,PASS,DATABASE);
$stmt = mysqli_prepare($connection,'INSERT INTO `'.TABLE_ALBUMS.'` (albumName) VALUES (":album")');
mysqli_stmt_bind_param($stmt,':album');
$result = mysqli_stmt_execute($stmt);
if($result){
return true;
} else {
return false;
}
}
我得到這個錯誤:PHP和MySQL準備好的語句
mysqli_stmt_bind_param() [function.mysqli-stmt-bind-param]: Number of elements in type definition string doesn't match number of bind variables
任何幫助,將不勝感激。
這個時候$連接 - >準備()將無法工作。我可以猜測,如果你在準備好行後'var_dump($ stmt)',你會得到一個'false'。 – s3v3n 2010-12-17 23:34:15
是的,它返回false,任何想法爲什麼? – Adamski 2010-12-17 23:38:24
可能你的sql語句沒有準備好?你檢查了錯誤嗎? – Rahly 2010-12-17 23:40:22