ShoeLace1291 Posted December 4, 2007 Share Posted December 4, 2007 I have a table called matches to store clan match results in. I also have a table called members that stores my clan's members in. In the matches table, there is a column called "participants". When I insert all members that participated in the match, the column for that row displays as, for example, 1, 2, 3, 4 (those are the player's id's. How would I get the information from 1, then 2, then 3, and finally 4 with a loop since they are all in the same column? Link to comment https://forums.phpfreaks.com/topic/80082-how-would-i-do-this/ Share on other sites More sharing options...
Stooney Posted December 4, 2007 Share Posted December 4, 2007 Here's a bit of code I pulled from one of my scripts that does what you're talking about. (in this case it's item rather than players) $count=4; //using 4 for the example for($i=0; $i<$count; $i++){ $id=1; //using 1 for the example $iteminfo=mysql_query("SELECT * FROM `stauctioneer_items` WHERE `itemid` = '$id'"); $row=mysql_fetch_array($iteminfo, MYSQL_NUM); //output the results } That will loop based on the value of $count, then you need to define $id and change it as needed per loop. But that's the jist of it. That will pull out information for each item I need the info for. Similar to your need, only items insead of players. Link to comment https://forums.phpfreaks.com/topic/80082-how-would-i-do-this/#findComment-405870 Share on other sites More sharing options...
fenway Posted December 4, 2007 Share Posted December 4, 2007 They're all in the same column?!?! Oh boy.... you need to look into normalization; take a look at the relevant post that I've stickied. You'll need another table. Link to comment https://forums.phpfreaks.com/topic/80082-how-would-i-do-this/#findComment-406126 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.