maharg
Technical User
- Mar 21, 2002
- 184
Hi folks,
I'm struggling to formulate a solution to this simple little task...
If I have 2 or more zip codes the same, I'd like to concatenate the names.
So, instead of outputting ...
102=Al Capone
123=Fred Bloggs
123=John Doe
123=Fred Fuzz
234=Henry Kissinger
I want to get ...
102=Al Capone
123=Fred Bloggs, John Doe, Fred Fuzz
234=Henry Kissinger
Any clues much appreciated!
Regards
Graham
I'm struggling to formulate a solution to this simple little task...
PHP:
foreach($db->query('SELECT zip, name FROM memberrecords ORDER BY zip ASC')as $record)
{
$zip=$record['zip'];
$name=$record['name'];
echo $zip."=".$name."<br>".PHP_EOL;
}
If I have 2 or more zip codes the same, I'd like to concatenate the names.
So, instead of outputting ...
102=Al Capone
123=Fred Bloggs
123=John Doe
123=Fred Fuzz
234=Henry Kissinger
I want to get ...
102=Al Capone
123=Fred Bloggs, John Doe, Fred Fuzz
234=Henry Kissinger
Any clues much appreciated!
Regards
Graham