hyster Posted March 30, 2013 Share Posted March 30, 2013 im stuck on a concept on how to do this and not the code (yet anyway lol). i created a series of pages for recording results from a game i play. i planned on using the date to group the results into gaming sessions. works fine apart from that we play the game late at night so the dates are split by midnight (we start say at 23:00 and finish at 01:00) so sorting by dates wont work. then i thought about a game session id but how do i set the trigger to start a new session and finish it ??? if it was just me using it id just have a box to manualy input 1 but i have 6-7 diffrent people inputting the data so i need it pretty much idiot proof. form/database options id: // hiden - auto indexed Clan:Type:Map:Result:Tier:Date: Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 30, 2013 Share Posted March 30, 2013 (edited) It all depends on how you want it to work. Here's a thought off the top of my head. 1. Create a session table with a session_id (auto-increment, start_time (default current_timestamp) and end_time. 2. When a user access the page to input the data, get the last record from the session table. If the session has an end_time, display output that there is no current session and give the user the option (button/link) to create a new session. If the session is still active (no end time) then display the normal form to the user, but also display something like "Enter data for the current session started as mm/dd/yyyy hh:mm.". Then give the user the option to close the previous session. Edited March 30, 2013 by Psycho Quote Link to comment Share on other sites More sharing options...
Jessica Posted March 30, 2013 Share Posted March 30, 2013 (edited) Your table should have an auto-incrementing primary id. You can also record the start and end times, and sort by them, the fact that they go over midnight makes no difference. Edit: What psycho said. Stupid forum.) Edited March 30, 2013 by Jessica Quote Link to comment Share on other sites More sharing options...
hyster Posted March 30, 2013 Author Share Posted March 30, 2013 so create a new temp table. create start session button to "clean" table (or just close the previous session when finish button used?). use the temp table to store the "current gaming session". when finished for the day close the "current gaming session" with a button to move data to the result table. temp_table session_id: // hiden - auto indexed Clan:Type:Map:Result:Tier:Date: final_table id: // hiden - auto indexed session_id: // hiden - auto indexed Clan:Type:Map:Result:Tier:Date: Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 30, 2013 Share Posted March 30, 2013 No, I was not suggesting a "temp" table. Just create a new table to store the game sessions. Then associate the records that go into the current data table to the appropriate session. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.