0
你能解釋一下爲什麼當我嘗試這個查詢時,它只返回一半行嗎?選擇查詢,while循環不能正確返回所有行
例如,如果$記錄是由4個值構成的,它只會從數據庫中獲得第1行和第3行。
怎麼了?
$query=mysql_query("SELECT * FROM ".DB_PREF."books WHERE book_id IN ('".$records."')");
while($fetch=mysql_fetch_assoc($query))
{
global $book_id, $book_title, $book_description, $book_author_id, $book_author_name, $book_author_surname;
$book_id=$fetch['book_id'];
$book_title=$fetch['book_title'];
$book_description=$fetch['book_description'];
$book_author_id=$fetch['book_author_id'];
$query=mysql_query("SELECT * FROM ".DB_PREF."profiles WHERE user_id='".$book_author_id."'");
$fetch=mysql_fetch_assoc($query);
$book_author_name=$fetch['user_name'];
$book_author_surname=$fetch['user_surname'];
getModule('htmlmodule...');
}
謝謝。我很愚蠢:P – 2012-04-13 17:26:15