PHP MySQL Where
The WHERE clause is used to filter records, which is to query the data under our specified conditions
Syntax
Let us use the following example:
Example
The following example will select all FirstNames from the "MyGuests" table ='Mary' row:
"; } ?>
Program execution result:
Use where condition to query all the data of FirstName='Mary' come out.
We now use phpadmin to add an Age field to the MyGuests table
The data in the table now looks like this:
Example
We now use the where clause to query those with Age less than 25:
"; } ?>
Program running results:
You can also use the following conditions
## Type | Detailed explanation |
select field from table where where condition; | |
select * from money where age = 29; | |
Query all results with age 29 in the MyGuests table |
Symbol | Description |
is greater than | |
Less than | |
Greater than or equal to | |
Less than or equal to |
Not equal to | |
Equal to |
Logical operators
## Symbol | Description | ## or
and | |
We query the data of 'firstname'='Julie' and Age=24
"; } ?>Program running results: