How can multiple conditions be used in a SQL query in PHP?

When using multiple conditions in a SQL query in PHP, you can use the "AND" or "OR" operators to combine the conditions. This allows you to filter data based on multiple criteria in the WHERE clause of your SQL query. Make sure to properly structure your conditions and use parentheses to group them if necessary for clarity and accuracy.

// Example of using multiple conditions in a SQL query in PHP
$query = "SELECT * FROM users WHERE age > 18 AND city = 'New York'";
$result = mysqli_query($connection, $query);

// Check if the query was successful
if ($result) {
    while ($row = mysqli_fetch_assoc($result)) {
        // Process the retrieved data
    }
} else {
    echo "Error: " . mysqli_error($connection);
}