PHP MySQL Where Clause
To select only data that matches a specified criteria, add a WHERE
clause to the SELECT
statement.
The following example creates and populates a Customers
table using the following SQL commands:
CREATE TABLE Customers (
ID INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(16) NOT NULL );
INSERT INTO Customers (name) VALUES ('Ben'), ('Bart'), ('Mandy'), ('Ella');
|
and selects customers using the
BETWEEN ... AND
operator:
SELECT * FROM Customers WHERE ID BETWEEN $low AND $high;
|
I saw a guy spill all his Scrabble letters on the road.
I asked him, “What’s the word on the street?”
|