Here is the code:
<?php
$q = 'SELECT * FROM categories ORDER BY category';
$r = mysqli_query($dbc,$q);
while (list($id,$category) = mysqli_fetch_array($r,MYSQLI_NUM)) {
echo '<li><a href="category.php?id=' . $id . '" title="' . $category . '">' . $category . '</a></li>';
}
?>
It looks as though the variable names $id and $category are assigned to a single row fetched from the database through each iteration of the loop. Every time the loop starts over, the next row is chosen. My question is: how does it know to pick the next row in the table?
It's not like the rows are indexed, such that a 'for' loop can step through all the rows of the table. Can someone explain this to me?