Re-using a result set

From: Date: Thu, 11 Jan 2001 20:02:21 +0000
Subject: Re-using a result set
Groups: php.db 
Request: Send a blank email to php-db+get-5807@lists.php.net to get a copy of this message
Hello, everyone -- I'm new to the list, and to PHP. I own a very large, very active original humor website which currently consists of over 2000 HTML documents, and I'm converting it to a database-driven model which should reduce that amount to less than 100. I'm from an old school dBase/Clipper/FoxPro background, and thought this would be a snap, but a few little things have got me utterly stumped. For example, is there any way to re-use a query result set? I successfully run this query: $sql = "SELECT item_num, item FROM list_items"; $sql_result = mysql_query($sql,$connection) or die ("Couldn't get list!"); Then loop through the result set using: while ($row = (mysql_fetch_array($sql_result))) { // whatever } Later in the same document, I'd like to go back to that same result set and loop through it again, rather than having to make another identical query. Any ideas would be greatly appreciated. TIA, Chris White TopFive.com P.S. Julie Meloni -- nice to see you on the list! Your "PHP Essentials" was the first PHP book I bought and I recommend it very highly to anyone wanting to ramp up to a working knowledge of PHP as fast as possible.

« previous php.db (#5807) next »