I am making a website for a futsal club and I created a table with the names of players in php that will fetch information from a database and wanted, if possible, to make links through the names to pages with more detailed information about the players. This is code to create the tables:
<?php
$servername ="localhost";
$username="root";
$password="";
$dbname="casaldogrilo";
//cria conexão
$conn = new mysqli($servername, $username, $password, $dbname);
// verifica conexão
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM juniores order by Nome ASC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table style='width:100%' height='100%'>
<tr>
<th>Nome</th>
<th>Data_Nasc</th>
<th>Idade</th>
<th>Nacionalidade</th>
</tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr>
<td align='center'>".$row["Nome"]."</td>
<td align='center'>".$row["Data_Nasc"]."</td>
<td align='center'>".$row["Idade"]."</td>
<td align='center'>".$row["Nacionalidade"]."</td>
</tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>