PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How do I include a conditional in my mysql query?


You will usually need to apply some logic to the query that you apply to a table, and this is easily done with the WHERE keyword.

This will be followed by a fieldname, or list of them, and then the condition you want to be met.

Thus if you want to select only rows from a table WHERE the user is called Quentin you would do the follow:

<?php
$peeps 
mysql_query("SELECT * FROM users WHERE firstname = 'Quentin'");
?>



More mysql PHP Questions

How do I find the ID of a new row added to a table?
How do I limit the number of rows returned?
How do I find second highest value from a table?
How do I delete a row from a table?
How do I set a default value for ENUM fields in PHP?