PHP Code File:-
This program is about how to insert record into the database using html form.<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "my_db";
$con = new mysqli($servername, $username, $password, $dbname);
if ($con->connect_error) {
die("Connection failed: " . $con->connect_error);
}
$select= "select * from my_login";
$result = $con->query($select);
?>
HTML Code File:-
<thead>
<tr>
<th>No</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
<th>Action</th>
</tr>
</thead>
<?php
$i=1;
while($row = $result->fetch_assoc()) { ?>
<tbody>
<tr>
<th scope="row">
<?php echo $i++; ?>
</th>
<td>
<?php echo $row["name"] ?>
</td>
<td>
<?php echo $row["email"] ?>
</td>
<td>
<?php echo $row["password"] ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
No comments:
Post a Comment