PHP Questions Home
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

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'");
?>



ASK A QUESTION

More mysql PHP Questions

how can I show an image from mysql?

Equip table and Vendor table. Each piece of equipment has a matching vendor ID. How to display vendor name instead of ID in PHP output?

How do I insert the date into my table?

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

I'm creating a table to store clients' info via PHP; can I make an inquiry field where the client can enter comments about their inquiry?



Custom Search