What is the correct syntax for a MySQL comparison query in PHP?

When writing a MySQL comparison query in PHP, it is important to ensure that the syntax is correct to avoid any errors. One common mistake is not properly concatenating variables within the query string. To solve this issue, make sure to properly concatenate variables using the dot (.) operator within the query string.

// Example of correct syntax for a MySQL comparison query in PHP
$age = 30;
$query = "SELECT * FROM users WHERE age > " . $age;
$result = mysqli_query($connection, $query);

// Check if query was successful
if($result){
    // Process results
} else {
    echo "Error executing query: " . mysqli_error($connection);
}