我正在使用来自两个查询的数据创建一个表,并尝试将它们连接到一个表中。尝试使用这样的东西:
$counter = 1;
echo '<table border="0" cellpadding="0" cellspacing="3"><tr>
<td width="10%">Miejsce</td>
<td width="25%">Nick</td>
<td width="20%">SteamID</td>
<td width="20%">Punkty</td>
</tr>';
while($row = mysql_fetch_array($skill_b) AND $row2 = mysql_fetch_array($sid_b))
{
echo '<tr class="select">';
echo '<td>'.$counter.'</td>';
echo '<td><center>'.$row['lastName'].'</center></td>';
echo '<td><center>'.$row2['uniqueId'].'</center></td>';
echo '<td><center>'.$row['skill'].'</center></td>';
echo '</tr>
$counter++;
}
echo '</table>';
和
$counter = 1;
echo '<table border="0" cellpadding="0" cellspacing="3"><tr>
<td width="10%">Miejsce</td>
<td width="25%">Nick</td>
<td width="20%">SteamID</td>
<td width="20%">Punkty</td>
</tr>';
echo '<tr class="select">';
echo '<td>'.$counter.'</td>';
while($row = mysql_fetch_array($skill_b))
{
echo '<td>'.$row['lastName'].'</td>';
}
while($row2 = mysql_fetch_array($sid_b))
{
echo '<td>'.$row2['uniqueId'].'</td>';
}
while($row3 = mysql_fetch_array($skill_b))
{
echo '<td>'.$row3['skill'].'</td>';
}
$counter++;
echo '</table>';
第二个几乎可以工作,尽管它使整个表崩溃,所以我看不到所有结果。
如果其中可以更改某些内容,则查询如下所示:
$query_skill = sprintf(
"SELECT skill, lastName
From hlstats_Players
ORDER BY skill DESC
LIMIT 10");
$skill_b = mysql_query($query_skill);
$skill = mysql_result( $skill_b, -1 );
$query_sid = sprintf(
"SELECT uniqueId
From hlstats_PlayerUniqueIds
WHERE playerId='$pid_b'"
);
$sid_b = mysql_query($query_sid);
$sid = mysql_result( $sid_b, 0 );