Try calling:
mysql_data_seek($connection, 0);
then looping through again. This should reset the row pointer to the first
row so that you can go through again :)
Sean
-----Original Message-----
From: TopFive [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 11, 2001 3:02 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re-using a result set
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.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]