Steve Buehler wrote:

At 08:11 PM 1/5/2005, you wrote:

Hi list,

How can I traverse the recordset moret than once?

For example, the recordset $sth is returned from executing the sql statement.
The following statement is writen with the "for" loop for retrieving each record from the recordset.


$aref = $sth->fetchrow_arrayref

However when the "for" loop is finished, the pointer of the recordset is point to the end of the recordset. How can I revise the point to the beginning of the recordset ($sth)?


Another thing you might try is to Set
$arefgood = $sth->fetchrow_arrayref
$arefusethisone = $arefgood
Use the $arefusethisone in the for loop. When you want to restart the for loop, just set "$arefusethisone = $arefgood" again. Doing this, you should always have your original. This will probably work in any language you are programming in, but since I don't program in to many languages, I can't give you a definite on that one.


Thanks I hvae thought about this method, but conerning that it will require extra memory to keep the orginal copy of the recordset, and also whenever assign the original recordset to the temprecordset, it will need to take extra time to do the copies, I assumed this is not shadow copies.

Sam

Steve



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to