Hi , I am trying to create a web application with an MySQL database where users can create their own teams and players and then use this to manage a football league table. I have done the code to allow users to create their own players and teams. Now I want the system to automatically generate the fixtures list based on the teams the user has created. Each team must play each other twice but the same team cannot play on the same week, and of course cannot play themselves. Below is the code that I have used to enable users to choose how many teams they want to add to the league and then name these teams.
<script> $(document).ready(function() { $("#teams").change(function() { var htmlString = ""; var len = $("#teams").val(); for (var i = 0; i < len; i++) { htmlString += "<label>Team name: </label><input type='text' id='team"; htmlString += i; htmlString += "' name='team"; htmlString += i; htmlString += "' class='email'><br/>"; } $("#teamnames").html(htmlString); }); }); </script>
In the MySQL database I have the headings : FixtureID, FixtureDate, homeTeam,awayTeam, leagueName.
Please could someone help me on the PHP code to automatically generate these fixtures, and then have the fixtures stored to the database. Thanks.