show the data

<style>
	table, th, td {
	  border: 1px solid black;
	  border-collapse: collapse;
	  border-color: #96D4D4;
	}
</style>
<table>
  <tr>
    <th>ID</th>
    <th>Name</th>
    <th>Email</th>
    <th>Action(edit)</th>
    <th>Action(delete)</th>
  </tr>
  <?php
  // Connect to the database
  $conn = mysqli_connect("localhost", "root", "", "PHP_experiment");
  // Check connection
  if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
  }
  // Query to retrieve all rows from the 'users' table
  $sql = "SELECT * FROM users";
  $result = mysqli_query($conn, $sql);
  // Loop through the result set and output each row as a table row
  while ($row = mysqli_fetch_assoc($result)) {
    echo "<tr>";
    echo "<td>" . $row['id'] . "</td>";
    echo "<td>" . $row['name'] . "</td>";
    echo "<td>" . $row['email'] . "</td>";
    echo "<td><a href='update_form.php?id=" . $row['id'] . "'>Edit</a></td>";
    echo "<td><a href='delete_form.php?id=" . $row['id'] . "'>Delete</a></td>";
    echo "</tr>";
  }
  // Close the database connection
  mysqli_close($conn);
  ?>
</table>

Last updated