bschultz Posted January 17, 2008 Share Posted January 17, 2008 I'm a radio announcer that does play-by-play for hockey games. I'd like to create an online scoresheet so that I type in the jersey number of the player that scored and what time is on the scoreboard, and the php and database will print the players name and what time the goal was scored (if there's 8:00 on the clock when a goal is scored, the goal was scored at 12:00 - - - 20:00-8:00=12:00). I have this working using html forms to insert into a database, but I currently have the players in a dropbox to insert the name and not the jersey number...I also have a drop box with the math of the time. The problem is that the page size is 210K...and I'm on dial up at some of these hockey arenas. Here's my question. I'd like to have php convert the numbers to names. Would it be easier or better to do this PRIOR to inserting to the DB...or should I just insert the number into the DB, and then print the name out on the page that gets the info from the DB? Also, how should I go about converting the time? Thanks. Brian Quote Link to comment https://forums.phpfreaks.com/topic/86540-solved-design-question/ Share on other sites More sharing options...
fenway Posted January 18, 2008 Share Posted January 18, 2008 Names can be pulled by lookup the number, which I presume is unique for each team (though not across seasons). As for the time, decide which way to you want to store it, and the convert it back if you need to. The TIME field will be useful for this. Quote Link to comment https://forums.phpfreaks.com/topic/86540-solved-design-question/#findComment-442789 Share on other sites More sharing options...
bschultz Posted January 18, 2008 Author Share Posted January 18, 2008 If I store just the number in the DB, how would I go about getting the name back out? I've thought of using an array...but didn't know how to get $player[23] to show up when all that's in the DB is 23. Thanks. Brian Quote Link to comment https://forums.phpfreaks.com/topic/86540-solved-design-question/#findComment-443067 Share on other sites More sharing options...
revraz Posted January 18, 2008 Share Posted January 18, 2008 You need a Player DB that has his name and number in it. Quote Link to comment https://forums.phpfreaks.com/topic/86540-solved-design-question/#findComment-443088 Share on other sites More sharing options...
bschultz Posted January 22, 2008 Author Share Posted January 22, 2008 Thanks for the help on this...but is there a way to put the roster in a text file, or declare the values in the php page? Quote Link to comment https://forums.phpfreaks.com/topic/86540-solved-design-question/#findComment-446109 Share on other sites More sharing options...
revraz Posted January 22, 2008 Share Posted January 22, 2008 Sure can. Quote Link to comment https://forums.phpfreaks.com/topic/86540-solved-design-question/#findComment-446125 Share on other sites More sharing options...
bschultz Posted January 22, 2008 Author Share Posted January 22, 2008 I know that I could do a GIANT if statement (which I supposed I could make into a function so that I only needed to put it in once...but is there another way? If so, can you a push in the right direction? Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/86540-solved-design-question/#findComment-446186 Share on other sites More sharing options...
bschultz Posted January 23, 2008 Author Share Posted January 23, 2008 Here's what I've come up with...but I'm getting an error: <?php if { $_POST[team] = "BSU"; switch ($_REQUEST['assist1']) { case "1": $assist1 = "player 1 name"; break; case "3": $assist1 = "player 3 name"; break; } else { switch ($_REQUEST['assist1']) { case "1": $assist1 = "player 1 name"; break; case "3": $assist1 = "player 3 name"; break; } } ?> What I'm trying to do is if the team is the home team, enter their names...if not, enter the visitors name. Parse error: syntax error, unexpected '{', expecting '(' in goal.php on line 2 Quote Link to comment https://forums.phpfreaks.com/topic/86540-solved-design-question/#findComment-446953 Share on other sites More sharing options...
bschultz Posted January 23, 2008 Author Share Posted January 23, 2008 Ignore the last one...figured out that error...here's the new one. <?php if ( $_POST[team] == "BSU" ) { switch ($_REQUEST['goal']) { case "1": $goal = "player 1 name"; break; case "2": $goal = "player 2 name"; break; } else { switch ($_REQUEST['goal']) { case "1": $goal = "player 1 name"; break; case "2": $goal = "player 2 name"; break; } } ?> Parse error: syntax error, unexpected T_ELSE in /goal.php on line 9 Quote Link to comment https://forums.phpfreaks.com/topic/86540-solved-design-question/#findComment-446961 Share on other sites More sharing options...
bschultz Posted January 23, 2008 Author Share Posted January 23, 2008 I got it... <?php if ( $_POST[team] == "BSU" ) { switch ($_REQUEST['goal']) { case "1": $goal = "player 1 name"; break; case "2": $goal = "player 2 name"; break; } } elseif ( $_POST[team] != "BSU" ) { switch ($_REQUEST['goal']) { case "1": $goal = "player 1 name"; break; case "2": $goal = "player 2 name"; break; } } ?> Thanks for all the help guys! Quote Link to comment https://forums.phpfreaks.com/topic/86540-solved-design-question/#findComment-446984 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.