I have my SQL table:
+----+-----+-------+-------+
| id | reg | in | out |
+----+-----+-------+-------+
| 1 | a | 11:10 | |
| 2 | a | | 11:30 |
| 3 | b | 06:10 | |
| 4 | c | | 07:10 |
+----+-----+-------+-------+
I have it sorting to an array so that it will match up if the reg is the same and in is before out so for example:
array(
[0]=> array('reg'=>'a','in'=>'11:10','out'=>'11:30'),
[1]=> array('reg'=>'b','in'=>'06:10','out'=>''),
[2]=> array('reg'=>'c','in'=>'','out'=>'07:10')
)
I then need to resort this array so that its in order of time, but where there is both an in and out time only use the out time. So if this was sorted it would be:
array(
[0]=> array('reg'=>'b','in'=>'06:10','out'=>''),
[1]=> array('reg'=>'c','in'=>'','out'=>'07:10'),
[2]=> array('reg'=>'a','in'=>'11:10','out'=>'11:30')
)
I hope that makes sense, I have around 200 entries per day and I've spent all of my weekend trying to get it ordered but there seems to always be a stray.
The times will be a unix timestamp i've just put it in H:i here as the SQL will sort WHERE > midnight and < 00:01 that morning showing only the current day.
There is probably something really simple and obvious staring at me but I can't see it.