How can PHP and HTML be effectively used together to create a user-friendly interface for managing goods?

To create a user-friendly interface for managing goods using PHP and HTML, you can use PHP to interact with a database to store and retrieve information about the goods. HTML can be used to design the interface, displaying the goods in a visually appealing way and allowing users to easily add, edit, or delete goods.

<?php
// Connect to database
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "goods_db";

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

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

// Retrieve goods from database
$sql = "SELECT * FROM goods";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // Output data of each row
    while($row = $result->fetch_assoc()) {
        echo "ID: " . $row["id"]. " - Name: " . $row["name"]. " - Price: " . $row["price"]. "<br>";
    }
} else {
    echo "0 results";
}

$conn->close();
?>