覆盖变量时循环

时间:2016-03-17 15:55:06

标签: php

我有一个循环,我希望从变量中获取信息,但我只得到最后的结果因为循环覆盖$ players变量我怎样才能获得所有数据?

while($row4 = mysql_fetch_array($rs4))
{
    $steamid = $row4["steamid"];
    $price = $row4["price"];

    $rs5 = mysql_query("SELECT username,avatar FROM `users` WHERE `steamid`='".$steamid."'");
    $row5 = mysql_fetch_array($rs5);
    $user_name = $row5[0];
    $name = str_ireplace('cs-vacpot.com', ' <img src="assets/img/emotes/vacpot.png" class="img" alt="vacpot" width="15px" height="15px"><span class="text-warning"> Cs-Vacpot.com</span>', $user_name);
    $user_avatar = $row5[1];

    $players ='
    <tr>
            <td><img src="'.$user_avatar.'" alt="avatar" class="circle players-width"> '.$name.'</td>
            <td class="text-center">4</td>
            <td>
                <div class="progress progress-striped active" style="height:8px; margin:5px 0 0 0;">
                    <div class="progress-bar progress-bar-warning" style="width: 45%"></div>
                </div>
            </td>
            <td class="text-center"><span class="label label-warning">'.$price.'$</span></td>
    </tr>';

}

echo $players;

0 个答案:

没有答案