Your connection to the database is missing the fourth important parameter, the data / name of the database to which you want to connect.
Try It:
<pre>$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '123456';
$dbname = "" ;
$conn = new mysqli ($dbhost,$dbuser,$dbpass, $dbname);
$conn -> set_charset("utf8");
?>
<!DOCTYPE html>
<html>
<head>
<title> Retrive data</title>
</head>
<body>
<?php
if ($result = $conn -> query("SELECT*FROM example")) {
?>
<table>
<tr>
<td> Name</td>
<td>Email id</td>
</tr>
<?php
$i=0;
while($row = mysqli_fetch_array($result)) {
?>
<tr>
<td><?php echo $row["name"]; ?></td>
<td><?php echo $row["email"]; ?></td>
</tr>
<?php
$i++;
}
?>
</table>
<?php
}
else{
echo "No result found";
}
?>
</body>
</html>