For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > September 2004 > ADO: .movefirst ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ADO: .movefirst ?
Ward

2004-09-27, 8:55 am

Hi,


Question : How can I iterate more than once over a query resultset ?

Usually this is how I connect to my odbcdatabase (classic stuff) :

$object=odbc_exec($con,$sql);
while ($row=odbc_fetch_array($object) {

blablah;

}

Now suppose I want to loop through it again, how do I reset the pointer to
the beginning ?
I realize doing $row[]=odbc_fetch_array is an option.


thx

Ward

Thomas Stian Bergheim

2004-09-27, 8:55 am

On Mon, 27 Sep 2004 09:11:14 GMT, Ward <king.albert.II@for.president.com>
wrote:

> Hi,
>
>
> Question : How can I iterate more than once over a query resultset ?
>
> Usually this is how I connect to my odbcdatabase (classic stuff) :
>
> $object=odbc_exec($con,$sql);
> while ($row=odbc_fetch_array($object) {
>
> blablah;
>
> }
>
> Now suppose I want to loop through it again, how do I reset the pointer
> to
> the beginning ?
> I realize doing $row[]=odbc_fetch_array is an option.
>
>
> thx
>
> Ward
>


Afaik, odbc_exec (preferably using odbc_prepare) or your suggestion are
the alternatives you have.

Using postgre you could use pg_result_s..

--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com