这是我得到的-
$awards_sql_1 = mysql_query('SELECT * FROM categories WHERE section_id = 1') or die(mysql_error());
$awards_rows_1 = mysql_num_rows($awards_sql_1);
$awards_sql_2 = mysql_query('SELECT * FROM categories WHERE section_id = 2') or die(mysql_error());
$awards_sql_3 = mysql_query('SELECT * FROM categories WHERE section_id = 3') or die(mysql_error());
$awards_sql_4 = mysql_query('SELECT * FROM categories WHERE section_id = 4') or die(mysql_error());
$i = 0;
$records = mysql_num_rows($sections_query);
while($row_sections = mysql_fetch_array($sections_query)) {
echo "<h3>" . $row_sections['section_name'] . "</h3>";
echo "<ul>";
//while($categories = mysql_fetch_array($awards_sql_1)) {
for ($i = 0; $i < $awards_rows_1; $i++) {
echo "<li><strong>$categories['category_name']</strong>";
}
echo "</ul>";
}
出于某种原因,如果我注释掉嵌套在 while() 中的 for(),页面将正常加载,并且我会看到我所有的 h3,但是,每当我尝试在其中嵌套 for() 或 while() 时原来的while(),页面在重新加载时只是空白。
我究竟做错了什么?