Program to Access Data From database in PHP.

Here, we will write a program in php to update data in Mysql. Considering we have created the connection, database and the table with some data inside it.

view.php file

<?php
$db=mysqli_connect("localhost","root","","vsitdb");
$data=mysqli_query($db,"select * from student_details");

echo "<table border='1px'>";
echo "<tr>";
echo "<th>id</th>";
echo "<th>Name</th>";
echo "<th>Contact Details</th>";
echo "<th>Date of Joining</th>";
echo "</tr>";
while($row=mysqli_fetch_array($data)){
    echo "<tr>";
    echo "<td>" .$row[0]. "</td>";
    echo "<td>" .$row[1]. "</td>";
    echo "<td>" .$row[2]. "</td>";
    echo "<td>" .$row[3]. "</td>";
    echo "</tr>";
}
echo "</table>";
?>