Mysql
 sql >> Datenbank >  >> RDS >> Mysql

php listet MySQL-Daten in einer HTML-Tabelle in Spalten und Zeilen auf

Sie müssen einen JOIN verwenden , in Anlehnung an:

$result = mysqli_query($conn,"SELECT player.*, score.* FROM player LEFT JOIN score ON score.playerid = player.playerid ");

echo "<table>
<tr>
<th>Name</th>
<th>Last Name</th>
<th>Score</th>
</tr>";

while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['lastname'] . "</td>";
echo "<td>" . $row['score'] . "</td>";
echo "</tr>";
}
echo "</table>";