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 #181048 is a reply to message #181035] Sun, 07 April 2013 15:01 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 15:13, Frank Steinmetzger wrote:
> bill wrote:
>
>> On 4/7/2013 8:34 AM, Jerry Stuckle wrote:
>>> On 4/7/2013 7:34 AM, 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
>>>> […]
>>>>
>>> Does the information come from a SQL database? If so, I'd do it
>>> in SQL.
>>>
>>
>> Yes it does, 3 tables: users (therapist/physician), pt_info,
>> schedule.
>>
>> A little more of a hint please.
>
> You select two different appointments that have the same date:
>
> SELECT s1.patient_number AS pn, s1.time AS t1, s2.time AS t2,
> s1.duration AS d1, s2.duration AS d2
> WHERE s1.time=s2.time AND s1.time=<today's date>
> AND s1.patient_number=s2.patient_number
> AND s1.patient_number=<ID of patient of interest>
> AND s1.id!=s2.id
> AND s1.doctor_number!=s2.doctor_number
>
> Of course, those times don't work that way, b/c they have date *and* time,
> and you want to deal with date only. I'm not into advanced SQL, perhaps there
> is an SQL function to only extract and use the date part.
>

There is. date(time) will extract the date alone

> You then would need to PHP-fiddle the time and duration together for only
> those appointments that are today in a nested for-loop.
>
why not elect only 'todays' date in the first place?


--
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 04:25:15 GMT 2024

Total time taken to generate the page: 0.07001 seconds