HOW TO FETCH DATA IN THE DATABASE USING PHP WITH MYSQLI

Hey guys, Today we are learning MYSQLI FETCH QUERY execute in the database using PHP with MYSQLI.

1. HTML Source Code(Index.php)

<table border="1" cellspacing="10">
<tr>
<th>S. N.</th>
<th>Name</th>
<th>Email Id</th>
<th>Action.</th>
</tr>
<?php
$conn=mysqli_connect("localhost", "root", "", "testproject");
$query=mysqli_query($conn, "SELECT * FROM userdetails"); while($rows=mysqli_fetch_array($query)){
?>
<tr>
<td><?php echo $rows['id']; ?></td>
<td><?php echo $rows['name']; ?></td>
<td><?php echo $rows['email']; ?></td>
<td><a href="delete.php?id=<?php echo $rows['id']; ?>">Delete</a></td>
</tr>
<?php } ?>
</table>