Getting values of duplicate keys in array
| From: | Christoph Starkmann | Date: | Thu, 11 Apr 2002 11:20:40 +0000 |
| Subject: | Getting values of duplicate keys in array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-92542@lists.php.net to get a copy of this message | ||
Hi folks!
The following problem:
I got a db (mysql) with information about doctors.
Name, adress, phone etc.
Now I'm reading these information with a simple
mysql-query:
$queryString = "SELECT DISTINCT m.$sureName, m.$preName, m.$prax, m.$title,
";
$queryString .= "p.$town, p.$zip, p.$phone, p.$description ";
$queryString .= "FROM $medTable m, $praxTable p WHERE ";
$queryString .= "m.$prax = p.$id";
Normally, I print out the information like this:
Dr. med. John Doe // $title, $preName, $sureName
(shared practice) // description
Elmstreet 13 // $street
666 Amityville 23 // $zip, $town
phone: 0049 - 815 - 4711 // $phone
Okay. Now some of these folks are sharing a practice
($description in the above code == "shared practice").
I would like to have these grouped together like this:
Dr. med. John Doe // $title, $preName, $sureName
Dr. med. Allan Smithee
(shared practice) // description
Elmstreet 13 // $street
666 Amityville 23 // $zip, $town
phone: 0049 - 815 - 4711 // $phone
I am starting to get a little confused right here and right now.
This is the reason for being THIS detailed, too ;) Don't want to
mix anything up.
How would you achieve this goal fastest and "best"?
Creating a temp array and checking for double $description-s
which I store in the temp array and delete from the original one?
Or check this with the original array? How?
I found functions to get the value for one key in a hash, but not
for several values with the same key...
Sorry for the confusion, starting to get fuzzy...
Any ideas, hints?
Thanx alot,
Kiko
--
It's not a bug, it's a feature.
christoph starkmann
mailto:kiko@nfq.de
http://www.gruppe-69.com/
ICQ: 100601600
--