RE: [PHP] Group by Howto

From: Date: Tue, 13 Nov 2001 04:09:38 +0000
Subject: RE: [PHP] Group by Howto
Groups: php.general 
Request: Send a blank email to php-general+get-74361@lists.php.net to get a copy of this message
a "control break" code it what your after basically: $old_val = ""; for (??; ??; ??) { $new_val = $place; // however you get the next entry's place if ($new_val != $old_val) { $old_val = $new_val; echo $new_val; // obviously formatted... } echo $name; } now fill in the blanks Martin T -----Original Message----- From: lists@mhess.qn.net [mailto:lists@mhess.qn.net] Sent: Tuesday, November 13, 2001 2:58 PM To: php-general@lists.php.net Subject: [PHP] Group by Howto I have a database with 2 colums in it -------------|------| Place of work| Name | -------------|------| I want to print out a listing of peoples name by the place their work from a php script so Place 1 person a person b person c Place 2 person d Place 3 person F person G This has to be easy to do can anyone point me in the right direction...I understand I have to use the group by clause I just don't know how to get PHP to sort it Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#74361) next »