许多其他人都问了类似的问题,但我无法正确地对我的问题应用任何指导/答案。
所有有效记录的原始PHP循环:
while($row=mysqli_fetch_array($result, MYSQL_ASSOC))
{
$date = $row['date'];
$o_name = $row['o_name'];
$g_name = $row['g_name'];
echo "<tr>
<td>$date</td>
<td>$o_name</td>
<td>$g_name</td>
</tr>\n";
}
仅显示每个第n条记录的尝试失败(在本例中为第2条):
A:
$x=0
while($row=mysqli_fetch_array($result, MYSQL_ASSOC))
{
$date = $row[$x]['date'];
$o_name = $row[$x]['o_name'];
$g_name = $row[$x]['g_name'];
$x = $x + 2;
echo "<tr>
<td>$date</td>
<td>$o_name</td>
<td>$g_name</td>
</tr>\n";
}
B:
$x=0
while($row[$x]=mysqli_fetch_array($result, MYSQL_ASSOC))
{
$date = $row['date'];
$o_name = $row['o_name'];
$g_name = $row['g_name'];
$x = $x + 2;
echo "<tr>
<td>$date</td>
<td>$o_name</td>
<td>$g_name</td>
</tr>\n";
}
C:
$x=0
while($row[$x]=mysqli_fetch_array($result, MYSQL_ASSOC))
{
$date = $row[$x}['date'];
$o_name = $row[$x}['o_name'];
$g_name = $row[$x}['g_name'];
$x = $x + 2;
echo "<tr>
<td>$date</td>
<td>$o_name</td>
<td>$g_name</td>
</tr>\n";
}
我觉得我在球场和正确的区域,但是找不到座位。任何帮助是极大的赞赏。