RE: [PHP] Getting values of duplicate keys in array
| From: | Christoph Starkmann | Date: | Thu, 11 Apr 2002 12:27:31 +0000 |
| Subject: | RE: [PHP] Getting values of duplicate keys in array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-92552@lists.php.net to get a copy of this message | ||
Hi Justin!
> By testing for (shared house), you'd end up grouping them
> together like
> this:
>
> Fred Flintstone
> Wilma Flintstone
> Homer Simpson
> Marge Simpson
> Bedrock
> (shared house)
>
> ... which isn't your intended result.
Yes it is ;)))))
What you write is right but this is how I did it!
I've indeed got one medics table and one for practice/premise.
So in $medTable I simply store the id of the premise a doctor
is working.
> > $queryString .= "FROM $medTable m, $praxTable p WHERE ";
But I read from both tables, so I got the description and the id;
> Really, what you'd like to do is group people together based on their
> premises being the same. This of course is complicated by
> the fact that if
> the premises is misspelled, or changed slighly (Unit 2, Suite
> The real solution is a change in your data design. What you
> actually want
> is to relate Doctors to their premises/practice. Hence, I
> would have a
> table of Doctors, and a table of Premises, with an id being
> the key for
> each.
> This way Doctor #2 and Doctor #15 can both be associated with
> Premises #5.
> Better still, a Doctor may be associated with one or more practices.
> This seems like a smarter/quicker/faster/more future proof method than
> hoping for matches in the address and performing complex array sorts.
What you advice me to do is IMO the one and only right way and is
part of a standard normalisation process, isn't it?
Nevertheless,
Thanx for your hint; If I not already had this this would be an important
one! And btw., I learnd a new english word, too (premise).
So I always keep learning ;)
Cheers,
Kiko
--
It's not a bug, it's a feature.
christoph starkmann
--