.


Divya

PHP MySQLi Select statement Example


index.php

<?php
$servername='localhost';
$username='root';
$password='';
$dbname = "my_db";
$conn=mysqli_connect($servername,$username,$password,"$dbname");
$result = mysqli_query($conn,"SELECT * FROM students");
?>
<!DOCTYPE html>
<html>
<head>
<title> Retrive data</title>
</head>
<body>
<table>
<tr>
<td>id</td>
<td>First Name</td>
<td>Last Name</td>
<td>City</td>
<td>Email id</td>
</tr>
<?php
$i=0;
while($DB_ROW = mysqli_fetch_array($result)) {
?>
<tr class="<?php if(isset($classname)) echo $classname;?>">
<td><?php echo $DB_ROW["id"]; ?></td>
<td><?php echo $DB_ROW["First_name"]; ?></td>
<td><?php echo $DB_ROW["Last_name"]; ?></td>
<td><?php echo $DB_ROW["City_name"]; ?></td>
<td><?php echo $DB_ROW["Email"]; ?></td>
</tr>
<?php
$i++;
}
?>
</table>
</body>
</html>

How to Update Data in MySQL Using P...
How to Update Data in MySQL Using PHP
❮ Previous Next ❯

.