RE: [PHP-DB] Using A Query Results Multiple Times
| From: | Adam Douglas | Date: | Wed, 24 Oct 2001 14:37:28 +0000 |
| Subject: | RE: [PHP-DB] Using A Query Results Multiple Times | ||
| Groups: | php.db php.general | ||
| Request: | Send a blank email to php-db+get-13667@lists.php.net to get a copy of this message | ||
Thanks for the help. I had all the code right just had to add the
mysql_data_seek. Wasn't aware it operated in this manner.
> -----Original Message-----
> From: Peter Lovatt [mailto:pjln1@sunmaia.net]
> Sent: Tuesday, October 23, 2001 3:41 PM
> To: Adam Douglas; PHP-DB (mailing list) (E-mail); PHP-General (mailing
> list) (E-mail)
> Subject: RE: [PHP-DB] Using A Query Results Multiple Times
>
>
> Hi
>
> while(...)
> {
> do whatever
> }
>
> mysql_data_seek ($mysqlresultid, 0)
>
> while(...)
> {
> do whatever
> }
>
> mysql_data_seek ($mysqlresultid, 0)
> etc
>
> will set the pointer back to the beginning of the result set,
> so you can
> scan through it as many times as you need to, without needing
> to repeat the
> query.
>
>
> HTH
>
> Peter
>
> > -----Original Message-----
> > From: Adam Douglas [mailto:adouglas@venmarvent.com]
> > Sent: 23 October 2001 19:48
> > To: PHP-DB (mailing list) (E-mail); PHP-General (mailing
> list) (E-mail)
> > Subject: [PHP-DB] Using A Query Results Multiple Times
> >
> >
> > I have an instance where I have to query my MySQL
> database and then
> > use the multiple row results to create multiple pull down
> menus on a web
> > page. My problem is how can I take the results of the query
> and use them
> > more the once to create pull down menus? I've always used a
> while look to
> > fetch each row of the results and have it create the pull
> down menu as it
> > goes through each row. But doing it this way only stores one row
> > of results
> > in a variable. Is there a way I can grab all the results
> from a query that
> > would go into an array so I could use it multiple times?
> I've looking
> > briefly for a function to MySQL that would allow me to do
> this but haven't
> > found anything unless I misunderstand mysql_fetch_array function.
> > At first I
> > thought I could loop through my while loop and have it put the
> > results from
> > the query of each row in to a multidimensional array. But
> then how would I
> > add to the array after the initial row?
> >
> > BTW, I'm using PHP 3.0.16.... so I can't use the added array
> > functions that
> > PHP 4 has. I do plan on upgrading soon.
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-db-help@lists.php.net
> > To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>