How do I include a conditional in my mysql query?
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'");
?>
Comment on this Question and Answer >>>
ASK A QUESTION
More mysql PHP Questions
I am extracting data from a MySQL Database of which one of the data stored is seperated by a comma. For example, step1,go here,step 2,go there,step 3,go back etc etc. I want to know how to split the data at the comma and format it in html. Using the splitHow do I limit the number of rows returned?
How do I set a default value for ENUM fields in PHP?
how can I show an image from mysql?
Why does this code not work? Returns this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND ClaimNo = AND UserName = john' at line 2
