Re: Looping through a result

From: Date: Tue, 20 Apr 2004 08:48:52 +0000
Subject: Re: Looping through a result
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-33966@lists.php.net to get a copy of this message
Use only one query: SELECT category, item, ... ORDER BY category, item Now fetch rows, and keep the latest categoryID in a flag variable: - if fetched categoryID <> flag, close table, create a new table, add header row - otherwise add content row to the current table - update flag with the latest category ID BTW you may want to use the great PEAR HTML_Table package to generate your tables. HTH _________________________ ----- Original Message ----- From: "Rene Schoenmakers" <rene.schoenmakers@hccnet.nl> To: <php-db@lists.php.net> Sent: Tuesday, April 20, 2004 10:43 AM Subject: [PHP-DB] Looping through a result Hi, I want to make the following page, Category 1 Item 1 of category 1 Item 2 of category 1 Item 3 of category 1 Item 4 of category 1 Category 2 Item 1 of category 2 Item 2 of category 2 Item 3 of category 2 Category 3 Item 1 of category 3 Item 2 of category 3 Item 3 of category 3 Item 4 of category 3 Item 4 of category 3, using PHP and MySQL. Looping through a result is not the problem. But how do I use a second query while looping through a result and do I have to use more then 1 table in the database? Can somebody point me in the right direction? Tia, René -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.db (#33966) next »