FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » comparing arrays
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: comparing arrays [message #181047 is a reply to message #181035] Sun, 07 April 2013 14:59 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
On 07/04/13 12:34, bill wrote:
> I need to see if a patient has appointments with a psychotherapist and a
> physician on the same day.
>
> I request the schedule of each therapist and each physician as arrays of
> arrays:
> time, patient_number, duration (note, the therapist/physician id is not
> in the array)
> They are non-associative arrays (numeric keys)
> I might have 1..n physicians and 1..n therapists
> I can generate arrays of physicians and arrays of therapists
>
> Option 1 is a nightmare of nested foreachs
>
> I am sure there must be an array function that will permit this check.
> AFAIK, the _intersect functions require the same date in all, when what
> I want is "any".
>
> my current thought is to create arrays of just pt_number, merge the
> physician arrays, merge the therapist arrays, array_flip to move the
> values to keys and then array_intersect.
>
> But, before I try that I welcome any suggestions.
>
> bill
You need a better SQL statement to select patients and dates where this
condition exists. Don't do this in PHP, do it in Mysql.

Sadly my SQL is only good enough to know that this *can* be done, and
simply. It would take me hours to get the SQL query right, but
comp.databases.mysql is that way==>

Assuming you are in fact querying a database to get your arrays.

If not you bloody well should be :-)

--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Need help with stripping characters from numbers in array
Next Topic: Connecting to MySQL server....
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Dec 18 08:16:05 GMT 2024

Total time taken to generate the page: 0.03766 seconds