Using Conditionals
The problem with the SELECT statement as I have used it thus far is that it will automatically retrieve every record. While this isn’t a big issue when dealing with a few rows of information, it will greatly hinder the performance of your database as the number of records grows. To improve the efficiency of your SELECT statements, there are different conditionals you can use in an almost limitless number of combinations. These conditionals use the SQL term WHERE and are written much like you’d write a conditional in PHP.
SELECT * FROM tablename WHERE column = 'value'; SELECT email FROM users WHERE last_name = 'Lennon'; SELECT name FROM people WHERE birth_date = '2003-01-26';
Table 4.6 lists the most common operators you ...
Get PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.