hanaleiroll Posted July 23, 2008 Share Posted July 23, 2008 Hi, I need a little help with a php/mysql web app. It's a game where a user can pick winners in a surf contest, and based on their selections, the future heat draws are calculated. I have it working right now in a simple way where only one user can play at a time because their selections are actually updating the database.. so if another user were to play, the heat draw would be affected. So I would like to know how to handle multiple users playing the game with php. You can see the concept here: http://christiansurfmag.com/wctdraw/ Right now, I have flat file database (I know I need to change this, just not sure how). My database looks like this: sufer_tbl -------------- seed (ranking, constant) name round1 round2 round3 The way I have it working now is like this: 1. Pick round 1 heat winners 2. Your winners get a '1' in their round3 field. 3. Go to round 2.. Round 2 page loads and it first sets all surfers round2 = '1'. Then from the _POST superglobal the round 1 heat winners get their round 2 set to '0'. I call all surfers with a round2 = '1' in, sort them ASC by seed, then put them into their round 2 heats. 4. Pick round 2 heat winners 5. The winners get a '1' in their round3 field. 6. Go to round 3. All surfers with a '1' in their round3 column get called in, sorted and placed in their respective heats (heats are predetermined according to seed. Ex: heat 1: seed#9 vs seed#25 vs seed#40) So thats how you will see that I have it working... and it works great, but just not for multiple users. I don't know where to begin to make this happen. I've been told to have a relational database with primary and foreign keys and to use sessions to track the users game, but I don't know how to implement this. For those of you who look at the game I made, how would you go about making it so that I can have a login page and get multiple users to play the game. Games would not need to be saved, they could be deleted right away. In the future, my next step would be to allow a user to keep track of 10 games or so, then a graph would be displayed at the end of their last game, showing how many times certain round 3 matchups re-occur, but that's in the future. Thank you so much for reading this and helping me out.. I'm at the end of my ropes. Link to comment https://forums.phpfreaks.com/topic/116312-please-help-get-me-on-track-with-my-phpmysql-logic-example-web-app-provided/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.