Jump to content

Recommended Posts

this is my query. how do i get the last row in this?

 

								$selectadmissionquery=("SELECT pat_id, admit_status, admit_loc, admit_date, discharge_date, admit_encounter 
													FROM admission WHERE (pat_id = '$pat_id') ORDER BY admit_date ASC");
							$resultselectadmissionquery=mysql_query($selectadmissionquery);
							if (! $resultselectadmissionquery)
							{
								$error= "Error 333b";
							}

 

how do i get the admit_date of the last record in the above query?

Link to comment
https://forums.phpfreaks.com/topic/41835-solved-last-row-in-array-or-record/
Share on other sites

no no no. i need to execute a query to get all admit _dates for a patient.

 

then again, i have another admission for the same patient that falls between the obtained dates. i need to check and see where this date would fit in. i need to compare it with each admit_date in the above query! thats my ultimate goal

 

thanx for the quick reply.

say i have admit dates of 02/01/2007 at 4 15 pm, 02/01/2007 at 10 17 pm, 02/02/2007 at 10 18 pm, 02/03/2007 at 11 40 am, 02/04/2007 at 3 27 pm, 02/06/2007 at 3 28 pm and 02/08/2007 at  3 30 pm.

 

these are the dates returned with my query in ascending order. now, i have another date 02/05/2007 at 12 30 pm that needs to be inserted into the table after 02/04/2007! how do i do this? this is should now become the sixth record in the chain. how is this possible?

 

thanx for replying

no. this is relevant here. if i insert it as the last record in the table, then the system thinks its a new admission of the patient on a previous date. what i need here is that it should go and sit where it belongs to (date-wise). every record entered in this table is counted as an encounter. the doctor may suddenly remember he forgot that he visited this patient on that day and decide to enter it into the system. it shud not come be another entry after the patient has been released/discharged on 02/08/2007!

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.