NYCPHP Meetup

NYPHP.org

[nycphp-talk] php mysql question

Brian O'Connor gatzby3jr at gmail.com
Sat Oct 9 15:47:45 EDT 2004


If you want to do something along the lines of mysql_num_rows($result)
then do mysql_fetch_array($result) I don't believe that queries it
twice, and its the same data.


On Sat, 9 Oct 2004 14:10:30 -0300, Henry Ponce <henry at beewh.com> wrote:
> hello people:
> 
> i was wondering if someone tell me if this is possible...
> 
> i have this:
> 
> $q = 'select * from users';
> $result = mysql_query($q);
> 
> There's no problem with that. I want to know if i can do this:
>         $newresult = $result;
> 
> I want to run the query once, but use the result set again. Whenever i do
> this, $newresult is empty, for example when i place it in:
>         while ($row = mysql_fetch_array($newresult)){
> 
>         }
> 
> Can someone tell me the right way of doing this. I don't want to query the
> database more than once.
> 
> Thank you,
> Henry
> 
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP)
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.newyorkphp.org
> 


-- 
Brian O'Connor



More information about the talk mailing list