How can attributes of records be equated in a PHP MySQL query?

When comparing attributes of records in a MySQL query in PHP, you can use the `=` operator in the WHERE clause to equate the desired attributes. This allows you to filter the records based on specific attribute values. Make sure to properly structure the query with the correct syntax to ensure accurate results.

// Connect to the database
$connection = mysqli_connect("localhost", "username", "password", "database");

// Check connection
if (!$connection) {
    die("Connection failed: " . mysqli_connect_error());
}

// Query to select records with specific attribute values
$sql = "SELECT * FROM table_name WHERE attribute1 = 'value1' AND attribute2 = 'value2'";

$result = mysqli_query($connection, $sql);

if (mysqli_num_rows($result) > 0) {
    // Output data of each row
    while($row = mysqli_fetch_assoc($result)) {
        echo "Attribute1: " . $row["attribute1"]. " - Attribute2: " . $row["attribute2"]. "<br>";
    }
} else {
    echo "0 results";
}

// Close connection
mysqli_close($connection);