Jump to content

How would I do this?


ShoeLace1291

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.