Re: first record not displayed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paul Bern wrote:

> Hi,
> 
> I have the feeling I'm missing something very obvious here, but it's
> driving me nuts!   Using this select statement:
> 
> $result = mysql_query("SELECT * FROM latlong  ",$link);
> $nrows = mysql_num_rows($result);
> 
> 
> and either of these to display the results:
> 
> for ($j=0; $rec=mysql_fetch_array($result); $j++){
>      print "j=$j id={$rec["id"]} seq={$rec["seq"]}\n";
> }
> 
> 
> while($row =  mysql_fetch_array($result)){
>    echo "id={$row["id"]}  seq={$row["seq"]} \n";
> }
> 
> The very first record gets dropped/not displayed.  The number of records
> returned ($nrows) matches what I get from MySQL  and the first record gets
> displayed (using PHPMyAdmin).  Even if I change the select to pull only
> certain records, the very first one does not get displayed.
> 
> Can anyone shed any light on this for me?
> 
> Thanks!
> 
> Paul

That sounds like you may somewhere have a mysql_fetch_array() from which 
you are not using the result; thsat ill fetch the first record, and if you
then start using the data from a "while($row =  mysql_fetch_array" it will
start with the second record.

Something looks odd about your for loop, but my brain is a bit tired at the
moment and I can't pinpoint it :-)



Cheers
-- 
David Robley

This library isn't safe - I just stumbled on an idea.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux