index.php
<DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,
initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3
/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3
/dist/js/bootstrap.bundle.min.js"></script>
</head>
<title>Hancie e-Learning Studio</title>
<body>
<div class="container">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Age</th>
<th>DOB</th>
</tr>
</thead>
<?php
include ('connection.php');
$sql="SELECT * FROM bio";
$result=mysqli_query($conn, $sql);
if($result->num_rows>0){
while($row=$result->fetch_assoc()){
echo "<tr><td>" .$row['ID']. "</td><td>"
.$row['Name'] ."</td><td>"
.$row['Age'] ."</td><td>"
.$row['DOB'] ."</td></tr>";
}
}
else {
echo "No result";
}
?>
</table>
</div>
</body>
</html>
connection.php
<?php
$servername="localhost";
$username="root";
$password="";
$dbname="practice";
$conn=new mysqli($servername, $username, $password, $dbname);
if(!$conn){
die ("Could not connect" .mysqli_error());
}
?>
AnotherMethod.php
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Age</th>
<th>DOB</th>
</tr>
<?php
include ('connection.php');
$sql="SELECT * FROM bio";
$query=mysqli_query($conn, $sql);
while ($row=mysqli_fetch_array($query)) {
?>
<tr>
<td><?php echo $row['ID']?></td>
<td><?php echo $row['Name']?></td>
<td><?php echo $row['Age']?></td>
<td><?php echo $row['DOB']?></td>
</tr>
<?php
}
?>
</table>
Output