Skip to content Skip to sidebar Skip to footer

Retrieve All Row But The First Record Is Missing

$query = 'SELECT * FROM abc'; if ($result = $db->query($query)) { $row = $result->fetch_assoc(); while ($row = $result->fetch_assoc()) {

Solution 1:

In your code, you're calling $row = $result->fetch_assoc(); just before starting your while loop. This line is "consuming" your first raw and when you're entering in the loop, you move the cursor to the second row by calling this same method a second time.

The condition of the while loop is executed BEFORE the content, here you'll find more info about PHP While loop

To fix your code, remove this first line.

Post a Comment for "Retrieve All Row But The First Record Is Missing"