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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 2:58 PM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to