peterbarone Posted March 2, 2007 Share Posted March 2, 2007 I have a league based web site and I'm looking to make a script that can make a schedule of matches. Last year I did alot of hard coding with a ton of if statements (not very fun). There are 2 vars how many weeks you play number of teams I can post my old script if you need a better idea of what I'm trying to do. Quote Link to comment Share on other sites More sharing options...
simcoweb Posted March 2, 2007 Share Posted March 2, 2007 First, figure out what fields/info you have to have on each team. Then, create the input form for it. Next, write the script that inserts it into the database. Last, write the script that retrieves and displays it. Quote Link to comment Share on other sites More sharing options...
peterbarone Posted March 2, 2007 Author Share Posted March 2, 2007 I thought of that also. but I really wanted to make it automated ! Quote Link to comment Share on other sites More sharing options...
simcoweb Posted March 2, 2007 Share Posted March 2, 2007 Umm, I don't see how you can automate it without someone doing some input. What did you have in mind? Quote Link to comment Share on other sites More sharing options...
peterbarone Posted March 2, 2007 Author Share Posted March 2, 2007 that is the hard part that I'm getting stuck on. admin inputs number of weeks played and number of teams. They also have to setup the teams trough a form that get stored in database. each team is assigned an ID number. so this is how I think it needs to start $weeks=20; $teams=10; How is that for a great start ;D ;D Quote Link to comment Share on other sites More sharing options...
simcoweb Posted March 2, 2007 Share Posted March 2, 2007 Honestly? Not so good. Two variables don't make a script. I'm still confused as to what you are looking to do. Aside from the fact you want a scheduling system you don't have any idea of how it would work. I outlined that in my first post. Getting info into the database requires some insertion technique...typically a form with the questions/info you need. Then you need a way to extract it. Typically with a MySQL query. Then a way to display it. Typically a web page. I'm not sure what else I can tell you. Quote Link to comment Share on other sites More sharing options...
peterbarone Posted March 3, 2007 Author Share Posted March 3, 2007 Sorry dude I was just messin around with you. This is my old one. and it worked well. but there just seems like there should be a better way /**********old code**********/ <FORM NAME="selectView" ACTION="<?php $_SERVER [ 'PHP_SELF' ] ?>schfull.php " METHOD=POST> <strong> Please Select the Date to View:</strong> <select size="1" name="date"> <option value="">Week Number</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> </select><input type="submit" value="GO" > </form> <?php $date=$_POST['date']; $leagueid = 1; if ($date=="1") { $team1=1; $team2=2; $team3=3; $team4=4; $team5=5; $team6=6; $team7=7; $team8=8; $team9=9; $team10=10; } elseif ($date=="2") { $team1=1; $team2=3; $team3=2; $team4=4; $team5=5; $team6=7; $team7=6; $team8=9; $team9=8; $team10=10; } elseif ($date=="3") { $team1=1; $team2=6; $team3=2; $team4=9; $team5=5; $team6=4; $team7=3; $team8=8; $team9=7; $team10=10; }elseif ($date=="4") { $team1=1; $team2=10; $team3=2; $team4=8; $team5=3; $team6=7; $team7=4; $team8=6; $team9=5; $team10=9; }elseif ($date=="5") { $team1=1; $team2=4; $team3=2; $team4=7; $team5=3; $team6=9; $team7=5; $team8=8; $team9=6; $team10=10; }elseif ($date=="6") { $team1=1; $team2=8; $team3=2; $team4=10; $team5=3; $team6=5; $team7=4; $team8=9; $team9=6; $team10=7; }elseif ($date=="7") { $team1=1; $team2=5; $team3=2; $team4=6; $team5=3; $team6=10; $team7=4; $team8=7; $team9=7; $team10=9; }elseif ($date=="8") { $team1=4; $team2=10; $team3=1; $team4=7; $team5=2; $team6=5; $team7=3; $team8=6; $team9=8; $team10=9; }elseif ($date=="9") { $team1=1; $team2=9; $team3=2; $team4=3; $team5=4; $team6=7; $team7=5; $team8=10; $team9=6; $team10=8; }elseif ($date=="10") { $team1=1; $team2=2; $team3=3; $team4=4; $team5=5; $team6=6; $team7=7; $team8=8; $team9=9; $team10=10; }elseif ($date=="11") { $team1=1; $team2=2; $team3=3; $team4=4; $team5=5; $team6=6; $team7=7; $team8=8; $team9=9; $team10=10; }elseif ($date=="12") { $team1=1; $team2=2; $team3=3; $team4=4; $team5=5; $team6=6; $team7=7; $team8=8; $team9=9; $team10=10; }elseif ($date=="13") { $team1=1; $team2=2; $team3=3; $team4=4; $team5=5; $team6=6; $team7=7; $team8=8; $team9=9; $team10=10; }elseif ($date=="14") { $team1=1; $team2=2; $team3=3; $team4=4; $team5=5; $team6=6; $team7=7; $team8=8; $team9=9; $team10=10; }elseif ($date=="15") { $team1=1; $team2=2; $team3=3; $team4=4; $team5=5; $team6=6; $team7=7; $team8=8; $team9=9; $team10=10; }elseif ($date=="16") { $team1=1; $team2=2; $team3=3; $team4=4; $team5=5; $team6=6; $team7=7; $team8=8; $team9=9; $team10=10; }elseif ($date=="17") { $team1=1; $team2=2; $team3=3; $team4=4; $team5=5; $team6=6; $team7=7; $team8=8; $team9=9; $team10=10; }elseif ($date=="18") { $team1=1; $team2=2; $team3=3; $team4=4; $team5=5; $team6=6; $team7=7; $team8=8; $team9=9; $team10=10; }elseif ($date=="19") { $team1=1; $team2=2; $team3=3; $team4=4; $team5=5; $team6=6; $team7=7; $team8=8; $team9=9; $team10=10; }elseif ($date=="20") { $team1=1; $team2=2; $team3=3; $team4=4; $team5=5; $team6=6; $team7=7; $team8=8; $team9=9; $team10=10; } ?> <table width=50%> <thead><th>Match 1 for week <?php echo($date);?></th></thead> </table> <?PHP include 'golf.php'; $result = mysql_query("SELECT * FROM teams where teams.teamid= ('$team1') and $leagueid=$leagueid ") or die("SELECT Error: ".mysql_error()); while($row = mysql_fetch_array( $result )) { ?> <table width=50%> <tr class='whatever'> <td width=30%><center><?php echo$row['teamname'];?></center></td></tr> </table> <?php } ?> vs. <?php //include 'config.php'; //include 'opendb.php'; $result = mysql_query("SELECT * FROM teams where teams.teamid = ('$team2') and $leagueid=$leagueid ") or die("SELECT Error: ".mysql_error()); while($row = mysql_fetch_array( $result )) { ?> <table width=50%> <tr class='whatever'><td width=30%><center><?php echo$row['teamname'];?></center></td></tr> </table> <?php } ?> <br> <table width=50%> <thead><th>Match 2 <?echo($date);?></th></thead> </table> <?php $result = mysql_query("SELECT * FROM teams where teams.teamid = ('$team3') and $leagueid=$leagueid ") or die("SELECT Error: ".mysql_error()); while($row = mysql_fetch_array( $result )) { ?> <table width=50%> <tr class='whatever'> <td width=30%><center><?php echo$row['teamname'];?></center></tr> </table> <?php } ?> vs <?php $result = mysql_query("SELECT * FROM teams where teams.teamid = ('$team4') and $leagueid=$leagueid ") or die("SELECT Error: ".mysql_error()); while($row = mysql_fetch_array( $result )) { ?> <table width=50%> <tr class='whatever'><td width=30%><center><?php echo$row['teamname'];?></center></td></tr> </table> <?php } ?> <br> <table width=50%> <thead><th>Match 3 <?echo($date);?></th></thead> </table> <?php $result = mysql_query("SELECT * FROM teams where teams.teamid = ('$team5') and $leagueid=$leagueid ") or die("SELECT Error: ".mysql_error()); while($row = mysql_fetch_array( $result )) { ?> <table width=50%> <tr class='whatever'><td width=30%><center><?php echo$row['teamname'];?></center></td></tr> </table> <?php } ?> vs <?php $result = mysql_query("SELECT * FROM teams where teams.teamid = ('$team6') and $leagueid=$leagueid ") or die("SELECT Error: ".mysql_error()); while($row = mysql_fetch_array( $result )) { ?> <table width=50%> <tr class='whatever'><td width=30%><center><?php echo$row['teamname'];?></center></td></tr> </table> <?php } ?> <br> <table width=50%> <thead><th>Match 4 <?echo($date);?></th></thead> </table> <?php $result = mysql_query("SELECT * FROM teams where teams.teamid = ('$team7') and $leagueid=$leagueid ") or die("SELECT Error: ".mysql_error()); while($row = mysql_fetch_array( $result )) { ?> <table width=50%> <tr class='whatever'><td width=30%><center><?php echo$row['teamname'];?></center></td></tr> </table> <?php } ?> vs <?php $result = mysql_query("SELECT * FROM teams where teams.teamid = ('$team8') and $leagueid=$leagueid") or die("SELECT Error: ".mysql_error()); while($row = mysql_fetch_array( $result )) { ?> <table width=50%> <tr class='whatever'><td width=30%><center><?php echo$row['teamname'];?></center></td></tr> </table> <?php } ?> <br> <table width=50%> <thead><th>Match 5 <?echo($date);?></th></thead> </table> <?php $result = mysql_query("SELECT * FROM teams where teams.teamid = ('$team9') and $leagueid=$leagueid ") or die("SELECT Error: ".mysql_error()); while($row = mysql_fetch_array( $result )) { ?> <table width=50%> <tr class='whatever'><td width=30%><center><?php echo$row['teamname'];?></center></td></tr> </table> <?php } ?> vs <?php $result = mysql_query("SELECT * FROM teams where teams.teamid = ('$team10') and $leagueid=$leagueid") or die("SELECT Error: ".mysql_error()); while($row = mysql_fetch_array( $result )) { ?> <table width=50%> <tr class='whatever'><td width=30%><center><?php echo$row['teamname'];?></center></td></tr> </table> <?php } ?> /********end*********/ Quote Link to comment 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.