On 28 Apr 2005 01:13:08 -0700, micha wrote:[color=blue]
> Curt Bousquet wrote:[color=green]
>> Idaho Terry Pratchet
>> Vermont Dan Brown
>> Vermont Bob Smith
>> Virginia Alice Johnson
>> Virginia David Jones
>>
>> I would like to output the info like this:
>>
>> Idaho
>> Terry Pratchet
>> Vermont
>> Dan Brown
>> Bob Smith
>> Virginia
>> Alice Johnson
>> David Jones[/color]
>
> mysql takes care of your problem, have a look at SELECT and GROUP BY[/color]
No it doesn't, unless you propose to have separate queries for each
state. So Curt will have to do something like:
$state = '';
while ( $row = mysql_fetch_array( $res ) )
{
if ( strcmp( $state, $row['state'] ) )
{
$state = $row['state'];
echo $state."\n";
}
echo "\t{$row['firstname']} {$row['lastname']}\n";
}
--
Firefox Web Browser - Rediscover the web -
http://getffox.com/
Thunderbird E-mail and Newsgroups -
http://gettbird.com/