Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.