php-db | 2001011
Date: 01/11/01
- Next message: Finkel, Sean: "RE: [PHP-DB] Re-using a result set"
- Previous message: TopFive: "[PHP-DB] Re-using a result set"
- In reply to: TopFive: "[PHP-DB] Re-using a result set"
- Next in thread: Finkel, Sean: "RE: [PHP-DB] Re-using a result set"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Sure, just do:
mysql_data_seek($sql_result,0);
before you get to your while() the second time.
Hope this helps,
Joe
TopFive wrote:
> 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: php-db-unsubscribe <email protected>
> For additional commands, e-mail: php-db-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Finkel, Sean: "RE: [PHP-DB] Re-using a result set"
- Previous message: TopFive: "[PHP-DB] Re-using a result set"
- In reply to: TopFive: "[PHP-DB] Re-using a result set"
- Next in thread: Finkel, Sean: "RE: [PHP-DB] Re-using a result set"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

