Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP MySQL Where Clause

PHP MySQL Where Clause


The WHERE clause is used to filter records.


WHERE Clause

The WHERE clause is used to extract records that meet the specified criteria.

Syntax



SELECT column_name(s)

FROM table_name

WHERE column_name operator value

To learn more about SQL, please visit our SQL tutorial.

To make PHP execute the statement above, we must use the mysqli_query() function. This function is used to send queries or commands to the MySQL connection.

Example

The example below selects all rows from the "Persons" table where FirstName='Peter':



";

}

?>

The above code will output:



Peter Griffin