I have a for
loop that displays the first six items in a MySQL database. I then breakout to another piece of code, after which I have another for
loop that displays the next six items in my database.
Though this is exactly the functionality that I wanted, I am confused as to how it works, and was hoping somebody could clarify for me. How does the second for
loop know to start off where the first one left off?
My code is as follows:
for ($i = 1; $i <= 6; $i++) {
$row = mysqli_fetch_array($result);
$id = $row['id'];
$title = $row['title'];
$file = $row['file'];
// Display items
}
The second for
loop is exactly the same.