Jump to content

Recommended Posts

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: 

Link to comment
https://forums.phpfreaks.com/topic/276325-game-results-page/
Share on other sites

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 by Psycho
Link to comment
https://forums.phpfreaks.com/topic/276325-game-results-page/#findComment-1421960
Share on other sites

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 by Jessica
Link to comment
https://forums.phpfreaks.com/topic/276325-game-results-page/#findComment-1421961
Share on other sites

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:

Link to comment
https://forums.phpfreaks.com/topic/276325-game-results-page/#findComment-1421980
Share on other sites

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.