Jump to content

SQL conversion


maliary

Recommended Posts

  • Replies 57
  • Created
  • Last Reply

Top Posters In This Topic

 

Sorry for being so vague.

 

Well, what i mean is when i try searching using either the last name,  first name  or pid with the date range it doesn't give any results, when it actually should be.

 

Searching using a number with the date range -- for the encounter_nr -- produces the correct search results.

 

Here is the form that does the search,if it helps

 

<FORM action="<?php echo $thisfile; ?>" method="post" name="sform" onSubmit="return checkForm(sform.keyword)">

<B><?php echo 'Enter Date Range' ?></B></font><p>
From:<font size=3>
<INPUT  READONLY  type="text" name="from_date" size="20" maxlength="40" value=<?php echo '"'.$sBdayBuffer.'" '.$sDateJSfrom.' '?> </font>
<p></p>
To:    <font size=3>
<INPUT  READONLY   type="text" name="to_date" size="20" maxlength="40" value=<?php echo '"'.$sBdayBuffer.'" '.$sDateJSto.''?> </font>
<p></p>
<INPUT type="text" name="keyword" size="20" maxlength="40" value="<?php echo $keyword ?>"></font>
<input type=hidden name="search" value=1>  
<input type=hidden name="from" value="<?php echo $from_date ?>">
<input type=hidden name="to" value="<?php echo $to_date ?>"> 
<input type=submit name="submit" value=submit> 

</FORM>

Link to comment
Share on other sites

 

Yes I have,

 

The search key is passed through all the variables. But it still doesn't work.

I broke down the query into 3 parts and tested the individual tables.

 

this produces the required results when a name is passed through as the search key.

 


$SQL="SELECT p.name_last,p.name_first, f.*,e.*
        FROM   care_person AS p
        INNER JOIN care_encounter AS e  ON p.pid = e.pid
        INNER JOIN care_test_findings_chemlab AS f ON e.encounter_nr = f.encounter_nr WHERE  test_date  BETWEEN '".$pn."' AND '".$cw."' OR  p.name_last LIKE '$key%'  ";   
                                                                                                                         

 

when I try searching using both encounter number and search key. I find that it can only search using the encounter key but the search using the name stops working.

 

 


$SQL="SELECT p.name_last,p.name_first, f.*,e.*
        FROM   care_person AS p
        INNER JOIN care_encounter AS e  ON p.pid = e.pid
        INNER JOIN care_test_findings_chemlab AS f ON e.encounter_nr = f.encounter_nr WHERE  test_date  BETWEEN '".$pn."' AND '".$cw."' AND  (p.name_last LIKE '$key%' OR e.encounter_nr=$key) ";   
                                                                                                                         

Link to comment
Share on other sites

  • 1 year later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.