What is the correct syntax for the WHERE clause in a MySQL SELECT statement in PHP?

When using a WHERE clause in a MySQL SELECT statement in PHP, the syntax should be as follows: "SELECT * FROM table_name WHERE condition". The condition should be specified based on the specific criteria you want to filter the results by. Make sure to properly format the condition with the correct operators and values to ensure the query functions as expected.

<?php
// Connect to the 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);
}

// SQL query with WHERE clause
$sql = "SELECT * FROM users WHERE age > 18";

$result = $conn->query($sql);

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

$conn->close();
?>