PHP WHERE clause example to fetch records from Database Table

Ads
 

PHP WHERE clause example to fetch records from Database Table

PHP MYSQL Where clause example to fetch the records from the database table. PHP MYSQL WHERE clause can be used for any purpose ADD, EDIT, DELETE or Fetch records according to specified conditions. Go through the PHP MYSQL WHERE clause example that fetches records from the table employee.

PHP MYSQL Where clause example to fetch the records from the database table. PHP MYSQL WHERE clause can be used for any purpose ADD, EDIT, DELETE or Fetch records according to specified conditions. Go through the PHP MYSQL WHERE clause example that fetches records from the table employee.

You can query a MYSQL database based on multiple conditions. PHP & MYSQL Database offer various clauses to handle such kind of condition and perform different actions in MYSQL Database Tables. PHP WHERE Clause is one of them. We can use the WHERE clause in PHP & MYSQL to  add, edit or delete the data within the MYSQL database table. You can also fetch the results using the WHERE Clause in PHP.

Here is an example of how you can write the WHERE Clause query in PHP MYSQL example.

PHP MYSQL WHERE Clause Syntax

select * from employee1 where date = '2013-12-20';

This query will run on the MYSQL Server and will fetch the results from the database table employee date is equal to December 20, 2013.

The output of the Where Clause will look like this.

+-------+---------+------------+
| Empid | Empname | date |
+-------+---------+------------+
| 1 | Manish | 2013-12-20 |
| 4 | Gopal | 2013-12-20 |
+-------+---------+------------+
2 rows in set (0.00 sec)

To test the code we are using existing database table. You can create your own.

Ads

Ads