What is the difference between a simple HTML table and a PHP-generated table in terms of functionality and customization?

A simple HTML table is static and does not have the ability to dynamically generate content or interact with a database. On the other hand, a PHP-generated table can fetch data from a database, apply conditional formatting, and allow for more customization based on user input or other variables.

<?php
// Example PHP code to generate a table with data from a database

// Connect to database
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Fetch data from database
$sql = "SELECT * FROM table_name";
$result = $conn->query($sql);

// Generate table
echo "<table>";
echo "<tr><th>Name</th><th>Email</th></tr>";

if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        echo "<tr><td>" . $row["name"] . "</td><td>" . $row["email"] . "</td></tr>";
    }
} else {
    echo "0 results";
}

echo "</table>";

// Close connection
$conn->close();
?>