Re: PHP and Mysql Queries
| From: | Jason McCormack | Date: | Tue, 20 May 2003 15:46:31 +0000 |
| Subject: | Re: PHP and Mysql Queries | ||
| References: | 1 2 3 4 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27926@lists.php.net to get a copy of this message | ||
Thanks everyone for the prompt replies. I really appreciate the help. I
ended up using mysql_data_seek() after some further reading on php.net.
Edward - Good idea on the code snippet. I will keep that for future use.
Thanks again,
Jason
"Becoming Digital" <subs@becomingdigital.com> wrote in message
news:003301c31e93$f23a03e0$f5fa5044@becomingadmin...
> I don't know how you're calling the second run through the array, but the
> following might work and is a bit more elegant than a copy/paste job.
>
> for ( $i=0; $i<2; i++ ) {
> while($rows = mysql_fetch_array($h_navmenu))
> {
> $navmenu = $rows["navmenu"];
> echo $navmenu . "<br>";
> }
> mysql_data_seek($result ,0);
> }
>
>
> Edward Dudlik
> Becoming Digital
> www.becomingdigital.com
>
>
> ----- Original Message -----
> From: "Jason McCormack" <mccormack_j@hotmail.com>
> To: <php-db@lists.php.net>
> Sent: Tuesday, 20 May, 2003 00:24
> Subject: Re: [PHP-DB] PHP and Mysql Queries
>
>
> Peter,
>
> Thank you very much. Exactly what I was looking for.
>
> Jason
>
> Peter Lovatt wrote:
> > hi
> >
> > mysql_data_seek($result ,0) will move the result pointer to the
beginning of
> > the result set
> > then
> > while(.....)
> > {
> > ......
> > }
> >
> > as before
> >
> > Peter
> > -----Original Message-----
> > From: Jason McCormack [mailto:mccormack_j@hotmail.com]
> > Sent: 20 May 2003 05:01
> > To: php-db@lists.php.net
> > Subject: [PHP-DB] PHP and Mysql Queries
> >
> >
> > Hello All,
> >
> > I have a script that runs a mysql query against my database. I need to
> > loop through the array of data twice. My script runs the first loop as
> > expected but when it runs the second loop I get no data returned. Is
> > there a way to be able to loop through the same data result set twice
> > without having to take the data set and put it into a different array
> > variable. Any ideas are greatly appreciated.
> >
> > Thanks,
> > Jason
> >
> > Code Block
> >
> > $q_navmenu = "select navmenu,count(navmenu) as count from sitenav where
> > navgroup = 'toc' and active = 'T' group by navmenu order by
> > navmenu";
> > $h_navmenu = mysql_query($q_navmenu,$connect);
> >
> > while($rows = mysql_fetch_array($h_navmenu))
> > {
> > $navmenu = $rows["navmenu"];
> >
> > echo $navmenu . "<br>";
> > }
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>