Re: first record not displayed
| From: | Gerry Danen | Date: | Mon, 23 Jan 2006 22:09:39 +0000 |
| Subject: | Re: first record not displayed | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-41128@lists.php.net to get a copy of this message | ||
Paul,
Is $link relevant?
Have you run a repair on the table?
The for loop seems odd to me, but I use the while construct exclusively.
Adapted to one of my tables, this worked correctly:
$result = mysql_query("SELECT * FROM photos ");
while($row = mysql_fetch_array($result)){
echo "id={$row["p_id"]} seq={$row["p_desc"]} <br>\n";
}
On 1/23/06, Paul Bern <Phbern@syr.edu> 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
>
>
>
>
> ********************************************************************************************************
> Paul H. Bern, Ph.D.
> Numeric Data Services Librarian The only thing worse than not
> 352 Bird Library getting what you wanted
> 222 Waverly Ave. is getting what you asked for.
> Syracuse, NY 13244
> 315-443-1352
> http://library.syr.edu/information/mgi/nds
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Gerry
http://portal.danen.org/