Jump to content

hanaleiroll

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

hanaleiroll's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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.
  2. I should tell you that I did make this game as a flat file database, but the problem IS it only works for one user at a time because I currently have fields in my table (round1, round2, round3) that get updated when the user makes their selection. For instance, if a user picks surfer (seed #5) to win his heat, it would put a '1' for round3 in my db table column round3. If a different user was to play, there would be a '1' for that guy even if they didnt pick him to win. My scripting currently looks for all surfers with a value of '1' for round 3 to display them in the round 3 heat draw (and round 2 for round 2 heat draw). Here is the url to view what I've done... Thanks again! http://christiansurfmag.com/wctdraw/
  3. Hi, I need help with laying out my database. I'm trying to make a game where users can login and pick winners in a surf contest. There are 3 rounds in the surf contest and the heat draws are calculated by the surfers seed (ranking), 48 surfers in all. Round 1 (16, 3 man heats) HEAT 1 o surfer (seed #10) o surfer (seed #29) o surfer (seed #40) HEAT 2 o surfer (seed #9) o surfer (seed #30) o surfer (seed #39) ...etc. So in Round 1, you pick the guy you think will win by selecting the radio button. Then, I need to track the users selection somehow and send the winners into round 3 while the 2 losers go to round 2. Then round 2 page comes up: Round 2 (16, 2 man heats) HEAT 1 o surfer (seed #1) o surfer (seed #32) HEAT 2 o surfer (seed #2) o surfer (seed #31) ...etc. So, Round 2 is just like Round 1 where you pick your winner by radio button and the winner goes into round 3 while the loser is eliminated. Part of the trick is: If the number 1 seed wins his round 1 heat and moves directly into round 3, then the #2 seed (if he loses his round 1 heat and moves into round 2) becomes the #1 seed. So I need to track which seeds are in the round and sort them and re-seed them in ascending order, then call them into their respective heats based on the seed matchups. Round 3 is the result of the round 1 winners and round 2 winners. The heat draw would just be displayed, but no option of picking winners is to be offered. It would just look like this: This is Your Round 3 Heat draw: HEAT 1 surfer (seed #3) surfer (seed #9) HEAT 2 ..... So thats the idea. This is what I have for my database so far: user_tbl --------------- userID user_email user_password surfer_tbl --------------- surferID surfer_name surfer_seed game_tbl --------------- gameID userID I'm not sure where to go from here. I know I have those 3 entities (user, surfer, game). Any help is greatly appreciated and thanks a lot for reading about my project. If someone could maybe explain how I should set this up to best allow users to login and play a game, then be able to reset and play again, predicting a different winning scenario, it would be awesome. I just need the direction and method to implement this (sessions?). How should I set up the database and how should I temporarily track a users picks to give them the round 3 heat draw? I'm pretty new at this so Ive been reading as much as I can and searching for answers through online articles, I need help. THANK YOU!
  4. Thanks for the response Robin, I'll see if I can implement that... haven't used sessions yet. I really appreciate the tip!
  5. Heres what I did: I made a game to pick the winners and find out potential heat draws (match ups) for surf contests. Basically, in round 1 there are 3 man heats and you pick one winner for each heat. The winner goes straight into round 3, and the 2 losers go into round 2. Then in round 2, there are 2 man heats where the winner goes into round 3 and the loser is eliminated. Based on your round 1 choices, the round 2 heat draw is calculated (heat draws are calculated by the surfers seed number (rankings).. ex: heat 1 is #10 vs #26 vs #39). And based on your round 2 choices, the round 3 heat draw is calculated. Anyways, I have it working right now like this: My database is set up where I have fields: surfer name, seed number (ranking), round 1, round 2, round 3. In round 1, if the surfer is competing in the event, the value is set to '1', if not, it's set to '0'. So, for round 1, first I reset all surfers round 2 and 3 values to '0'. Then, I call all the surfers with round 1 set to '1', sort them ASC according to their seed number and put them into a variable containing an array. From the array, I put them into their correct heats. On submit, When you pick your winners, that basically sets their round 3 = '1'. When the round 2 page is loaded, I have scripting that first sets all surfers round 2 values = '1'. Then it gets all the surfers with round 3 values = '1' (your picked winners) and changes their round 2 = '0'. So it then gets the round 2 guys with '1', sorts them ASC and puts them into an array and from the array I put them into their respective heats. Then you pick your round 2 winners, and on submit, the winners round 3 = '1'. For the round 3 page, it calls all surfers with round 3='1', sorts them ASC, puts them into an array and distributes them into their respective heats for the final round 3 heat draw. The problem: Because of the way I have it set up, it only works for 1 person playing at a time. If I am playing and picking winners, its changing their values in the database. So if someone else tries to pick their winners, it's all screwed up. How can I get this going to where the client side is able to get the seed numbers from the database and things are manipulated client-side and heat draws are calculated that way? Any ideas? Thanks guys, sorry for the newbie question.
×
×
  • 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.