Re: PHP and Mysql Queries

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

 



> Edward - Good idea on the code snippet. I will keep that for future use.

You're quite welcome.  Apparently, my studies of algorithm design are paying
off. :)

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 11:46
Subject: Re:  PHP and Mysql Queries


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
003301c31e93$f23a03e0$f5fa5044@becomingadmin">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 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 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
>
>
>



--
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


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

  Powered by Linux