Non riesco a fare echo con questo codice. Grazie
Il codice sotto mi da errore >>> Fatal error: Call to a member function query() on boolean in /membri/database1/stampa_db.php on line 53 che sarebbe evidenziato cosi sotto a SELECT
>>>>>>>>>$result = $conn-> query($sql);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="AlterVista - Editor HTML"/>
<title>stampa_db</title>
<style type = "text/css">
table {
border-collapse: collapse;
width: 100%;
color: yellow;
font-family: monospace;
font-size: 25px;
text-align: left;
}
th {
background-color: green;
color: white;
}
tr: nth-child (even) {background-color: #f2f2f2 }
</style>
</head>
<body>
<table>
<tr>
<th>id</th> <th>numero</th> <th>nome</th>
</tr>
</table>
</body>
<?php
$conn = mysqli_connect("localhost", "root", "", "database1");
if($conn-> connect_error) {
die("connection failed:". $conn-> connect_error);
}
$sql = "SELECT id, numero, nome, FROM dati";
>>>>>>>>>>>>>$result = $conn-> query($sql);
if ($result-> num_rows > 0) {
while ($row = $result-> fetch_assoc()) {
echo "<TABLE BORDER=2>";
echo "<tr><td>"
. $row["id"] . "</td><td>"
. $row["numero"] . "</td><td>"
. $row["nome"] . "</td></tr>";
}
echo "</table>";
}
else {
echo "0 result";
}
$conn-> close();
?>
</html>