RichieW13 Posted September 14, 2011 Share Posted September 14, 2011 I am still very much a beginner in writing php code and using mySQL databases. In order to teach myself more, I'm building a project (in my mind so far) to teach myself some skills. What I want to do is create a little site for my fantasy football league. Basically, I want to upload the player scores each week so that I can use the data to write various reports (high point scorers, etc.) So each week I'll want to upload to my database the points scored for each player (there will be 140 players to upload each week). Each player will be in the database and have a unique number to identify them. So what would be the best way to upload the data? I guess I will write a PHP form to input the data manually, but how do I associate the unique ID for each player so that his data for each week get associated with his row in the PlayerID table? Do I have to create a dropdown list of all players in my database, and then pick him? That seems like a slow way to go. Quote Link to comment Share on other sites More sharing options...
MarPlo Posted September 14, 2011 Share Posted September 14, 2011 Hi, If you store the data that you want to upload in another location, you can associate in that location the data for each player with his id, then you write a script that reads those data and makes the upload automaticaly. But it depends how you store or where you have the data you want to upload. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted September 14, 2011 Share Posted September 14, 2011 Ultimately, you would want to write a script that scrapes the data from the same source you are manually getting it now and 'automatically' enter it into your database table by simply running the script. However, for a starting project, you would want to display the list of names (either all at once or broken up by some scheme to give a more manageable amount of data to enter at one time) with either an input field next to each name or a drop down select menu next to each name to enter/pick the score. You would typically use an array for the field name with the player's id as the index to the array so that the value you enter/select is associated with the id. See this link for how to use an array for the html field name - http://us2.php.net/manual/en/faq.html.php#faq.html.arrays Once the data is submitted, you can use php's array functions (such as foreach) to iterate over the data to get the id (the key/index of the array) and the score that was entered/picked. 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.