padams Posted August 18, 2007 Share Posted August 18, 2007 I have only rudimentary PHP skills so have been struggling a bit to solve this problem. I am trying to build a dynamic website for a sports club, that allows users to enter new matches with details such as who played and who scored, and have this automatically update players statistics. I have created a page where users can create a new match. On this page is a multiple-select List (named matchTeam) set up for users to select all of the players who played in the game. They click Submit and this sends all the data to a confirmation page. On this page I want a list of those players selected, along with how many games they have played. I have set up the List so that the value of the selected item(s) is playedID (a numeric primary key). This posts an array of a bunch of numbers to the confirmation page. I want to take this array and go to my mySQL database and go to the table called players, then create a recordset containing their names (in two fields, playerFirstName and playerLastName and the number of games they have played (playerGames). I will then echo this onto the confirmation page. Finally, I'd also like to have textfields appear next to the names and games information, so that I can enter the number of tries/touchdowns they have scored. When the user clicks the Confirm button, it should automatically add 1 to the playerGames value for each player, and add the number in the tries/touchdowns field to the playerTries value for those players. The problem I can't get my head around is that the matchTeam array that is posted to the confirmation page has multiple values in it, and I only know how to create a recordset based on one piece of information. How do I loop through the array and return the recordset with all the info I need? Sorry about the lengthy explanation, but it seems like a complex problem (to me anyway!). Quote Link to comment https://forums.phpfreaks.com/topic/65574-arrays-and-mysql/ 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.