我正在尝试查询五个表。我可以查询其中一张表
$query = "SELECT * FROM Stats_player WHERE player='$user'";
但是,当我尝试使用
$query = "SELECT * FROM Stats_player, Stats_block WHERE player='$user'";
网站中断。这是我用来在屏幕上回显数据的代码
<?php
if ($result = $mysqli->query($query)) {
echo "<img src=\"https://minotar.net/avatar/{$user}/100\"><h1>{$user}</h1><br/>";
while ($row = $result->fetch_assoc()) {
//variables
$play_time = $row['playtime']/3600;
$play_time = round($play_time, 1);
$xpgained = $row['xpgained'];
$damagetaken = $row['damagetaken'];
$toolsbroken = $row['toolsbroken'];
$itemscrafted = $row['itemscrafted'];
$itemseaten = $row['omnomnom'];
$commandsused = $row['commandsdone'];
$teleports = $row['teleports'];
$itemspickedup = $row['itempickups'];
$itemsdroped = $row['itemdrops'];
$lastseen = date("F j, Y ", strtotime($row['lastjoin']));
//end of variables
echo "<p>Time on Server: {$play_time} HRS</p>";
echo "<p>Last Seen: {$lastseen}";
echo "<p>Commands Used: {$commandsused}";
echo "<p>XP Gained: {$xpgained}";
echo "<p>Blocks broken: {$row['blockID']}"; //this is data from the table Stats_block
}
$result->free();
}
$mysqli->close();
?>
关于我如何做到这一点的任何想法?
Stats_player 的表结构:| 柜台 | 播放器 | 游戏时间 |
Stats_block 是:| 柜台 | 播放器 | 块ID |