Re: arrays, variables, and register_globals--solved--thank you
| From: | Matthew K. Gold | Date: | Thu, 25 Jul 2002 15:48:55 +0000 |
| Subject: | Re: arrays, variables, and register_globals--solved--thank you | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109524@lists.php.net to get a copy of this message | ||
Thank you very much, David--you understood the problem exactly and your
solution worked perfectly!
I'd like to add a comment about mysql_data_seek to the php manual entry on
mysql_fetch_row, because I would think that this might be a common
problem...
Matt
----- Original Message -----
From: David Robley <robleyd@paradise.net.nz>
To: GOLD, MATTHEW <MGOLD1@gc.cuny.edu>; <php-general@lists.php.net>
Sent: Thursday, July 25, 2002 5:37 AM
Subject: RE: [PHP-DB] Re: arrays, variables, and register_globals
> So what you want to do is print a field from the first row extracted from
the table, then
> loop through all the rows and print several fields? I think you want
mysql_data_seek.
>
> Whenever you do a mysql_fetch_row, php grabs the current row from the
result set, and
> shifts a pointer to the next record in the result set. In this case it
seems you need to
> print from the first record, then reset the pointer to the first record
and print from all
> records found. So:
>
> $row = mysql_fetch_row ($result))
> print ("$row[4]");
>
> mysql_data_seek($result, 0); // Add this
>
> while ($row = mysql_fetch_row ($result))
>
> Unless I misunderstand what you are trying to do....
>
> Cheers
> --
> David Robley
> Temporary Kiwi!
> Quod subigo farinam
>
> "I've been to a film festival in the South of France," said Tom cannily.
>