Hi all.
I have written a tracking application for my phone, and am now working on the web application side of it.
I currently have two tables, User and Location.
User:
UserID, phone#, email, password, name
Location:
UserID, Lat, Long, Alt, Speed, Bearing, Time, TrackID
A TrackID is generated when the user sends a tracking request to the phone. It is made of the UserID plus 4 random digits, and is sent to the device in the activation SMS.
Once it is confirmed that the activation SMS has been delivered, the web app moves to the map view where it selects all the records from the Location table - and displays the points as a route on a map.
I want the user to be able to view past 'tracks', but am not sure the best way of doing this.
I was thinking a drop down box, that would display the time stamps of each track from the Location table (where UserID = logged on User). However, this would have course return every single Location result that had that TrackID.
How would I select just the first time stamp and TrackID of each unique occurance? If I order by timestamp and take the first value, I'll only get data related to the first(or last) track.
I could pull all the data for that UserID out of the table and then programatically select what I need. But that doesn't feel a neat and tidy way of doing it.
I could create another table, Track. Which contains TrackID, UserID, initial time stamp.
Then to display past tracks, I could just query that table (which would be much smaller) and pull out time stamp and TrackID where UserID = logged on user.
But that does mean creating another table, which I (potentially) do not need.
What would you do?
I have written a tracking application for my phone, and am now working on the web application side of it.
I currently have two tables, User and Location.
User:
UserID, phone#, email, password, name
Location:
UserID, Lat, Long, Alt, Speed, Bearing, Time, TrackID
A TrackID is generated when the user sends a tracking request to the phone. It is made of the UserID plus 4 random digits, and is sent to the device in the activation SMS.
Once it is confirmed that the activation SMS has been delivered, the web app moves to the map view where it selects all the records from the Location table - and displays the points as a route on a map.
I want the user to be able to view past 'tracks', but am not sure the best way of doing this.
I was thinking a drop down box, that would display the time stamps of each track from the Location table (where UserID = logged on User). However, this would have course return every single Location result that had that TrackID.
How would I select just the first time stamp and TrackID of each unique occurance? If I order by timestamp and take the first value, I'll only get data related to the first(or last) track.
I could pull all the data for that UserID out of the table and then programatically select what I need. But that doesn't feel a neat and tidy way of doing it.
I could create another table, Track. Which contains TrackID, UserID, initial time stamp.
Then to display past tracks, I could just query that table (which would be much smaller) and pull out time stamp and TrackID where UserID = logged on user.
But that does mean creating another table, which I (potentially) do not need.
What would you do?