Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: comparing arrays

5 views
Skip to first unread message

The Natural Philosopher

unread,
Apr 7, 2013, 10:59:44 AM4/7/13
to
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.

bill

unread,
Apr 8, 2013, 8:44:53 AM4/8/13
to
Thank you for crossposting it for me, but, at this time I have a
solution (mysql) so don't burn any brain cells for me. I welcome
suggestions to check against my current solution.

bill
>

Jerry Stuckle

unread,
Apr 8, 2013, 9:27:06 AM4/8/13
to
If you'd like suggestions about your solution, you need to post the
solution (and table definitions would be a big help).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================
0 new messages