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

Example
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
<?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>";
?>