Hello,
I am working on the display of the records in the list form. displaying is not a problem but the counter (visit counter) is.
Each patient ID has the date visit, and I would like to sort them in ASC order. Also I would like to have a counter that can be reset to 1 when there is the next ID.
For example:
Patient ID: 1
Visit number: 1
Date: 31/01/2006 (or any date)
Patient ID: 1
Visit number: 2
Date: 01/02/2006 (or any date)
Patient ID: 2
Visit number: 1
Date: 31/01/2006 (or any date)
Patient ID: 2
Visit number: 2
Date: 01/02/2006 (or any date)
The point is that: The patients IDs should be sorted following their dates. And the counter needs to be resetted when the ID is changed. The counter doesn't need to be saved in database.
Here is the php code. I am trying my best to beat my head with it 🙂
$result = mysql_query("SELECT IDnum,datevisitFROM DataCollection ORDER BY IDnum AND datevisit");
while ($array1 = mysql_fetch_array($result1)) {
Thanks in advance 🙂