I'm working whit a simple site on a PHP server that print a series of data in a table but when i open it, instead of printing the data it prints {$row['tempLog']} etc. Where is the problem :\
connect.php
<?php
function Connection(){
$connection = new mysqli("localhost", "root", "EasyMon", "test");
if ($connection->connect_errno)
{
echo "Failed to connect to MySQL: (" . $connection->connect_errno . ") " . $connection->connect_error;
}
echo $connection->host_info . "\n";
return $connection;
}
?>
Here the index.php site:
<?php
include("connect.php");
$link=Connection();
$result=mysqli_query($link,"SELECT * FROM `Tabella1` ORDER BY `tempLog`");
?>
<html>
<head>
<title>Dati</title>
</head>
<body>
<h1>Potenziometro e sensore</h1>
<table border="1" cellspacing="1" cellpadding="1">
<tr>
<td> Timestamp </td>
<td> Temperature </td>
<td> Moisture </td>
</tr>
<?php
if($result!==FALSE){
while($row = mysqli_fetch_array($result)) {
echo ("<tr><td>{$row['tempLog']}</td><td>{$row['potenza']}</td><td>{$row['sensore']}</td></tr>");
}
mysqli_free_result($result);
mysqli_close($link);
}
?>
</table>
</body>
</html>