Jump to content

How To Echo Fields From The Sql Database That Are Older Than 30 Days


ScottC
 Share

Recommended Posts

Hi guys, im trying to make a page for my game (called fugitives) and what i want it to do is, echo users / accounts onto a page that have been inactive for longer than 30 days. Then the active users, will see an inactive user on there page and they have to kill that user (its a mafia type game) before midnight. After midnight a new account will appear.I do know PHP to an extent, but i have never made a PHP page from scratch before (only fixed errors and added tiny things), so i was wondering if anyone could maybe give me some guidance on how i could start this page.Any help will be appreciatedThanks.

Link to comment
Share on other sites

You'll need to know how to connect and use a database and how to process forms. The PHP section on the w3schools site has brief tutorials on both of those, so that would be a good place to start. PHP has date/time functions that you can use to get the current time, and you would need to store the last login time for each user in the database so you know which ones are inactive. The game logic to fight the other character is sort of up to you, but it's pretty much just getting a random inactive account from the database and doing whatever you want to do with it. You may also want to think of a way to verify that 2 people aren't attacking the same person, if that matters.

Link to comment
Share on other sites

You'll need to know how to connect and use a database and how to process forms. The PHP section on the w3schools site has brief tutorials on both of those, so that would be a good place to start. PHP has date/time functions that you can use to get the current time, and you would need to store the last login time for each user in the database so you know which ones are inactive. The game logic to fight the other character is sort of up to you, but it's pretty much just getting a random inactive account from the database and doing whatever you want to do with it. You may also want to think of a way to verify that 2 people aren't attacking the same person, if that matters.
I already have this game, and i have a last login date table in the database. Im just wondering how i would call the last login date, and actually print it onto the page. Thats what im stuck with.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...