Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resultset cutting off first record 1

Status
Not open for further replies.

deepatpaul

Programmer
Jul 7, 2004
57
0
0
US
I have a basic query that returns x rows. However, when I loop through the result, the first record is always ignored from the resultset. Eh?

This is what I am doing to call the database and loop through the results.

$report = mysql_query("Select this FROM that", $link);
$cnt = mysql_num_rows($report); // will say 5

while ($row = mysql_fetch_object($report)) { // will only output 4 (rows 1-4, ignoring 0)
$row->blahblah . "<br>";
}
 
Is this your entire code? Are you sure you're not invoking any of the fetch functions before the loop. If you are, exactly what you're mentioning will happen.
 
*slaps forehead*

Thank you so much! I would never have realized that (as simple and obvious as it is now).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top