Im not a hardvore coder. Im learning php/htmp/mysql/css now :)
So, i make mysql query with php, and now i want display the query result in a html table. But i don't know, how can i transfer variables between php and html code.
My php file now look like this:
<?php
$con=mysqli_connect("my_db_host","my_db_username","my_db_pass","my_db_name");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM hlstats_Servers
WHERE serverId='2'");
while($row = mysqli_fetch_array($result))
{
$name=$row['name'];
$ip=$row['address'] . ":" . $row['port'];
$player=$row['act_players'] . "/" . $row[max_players];
$map=$row['act_map'];
}
mysqli_close($con);
?>
<html>
<head>
</head>
<body>
<table>
<tr>
<td>$name</td>
</tr>
</table>
<table>
<tr>
<td>Ip cím:</td>
<td>$ip</td>
</tr>
<tr>
<td>Jelenlegi pálya:</td>
<td>$map</td>
</tr>
<tr>
<td>Játékosok</td>
<td>$player</td>
</tr>
</table>
</body>
</html>
$name) use<?php echo $name; ?>