Introduction
I will describe in this article how to use the MySQL "where" clause in PHP. The Where clause is a conditional clause in MySQL. The where clause fetches the records and allows you to filter the results from a MySQL statement.
Syntax Of a Simple Where Cause
|
SELECT * FROM table name |
Example
In this example, I am doing a simple fetch of records from the table. Here I execute the Mysql_Query() function.
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("smart", $con);
$result = mysql_query("SELECT * FROM form
WHERE name='ram'");
echo "<table border='1'>
<tr>
<th>ID</th>
<th>name</th>
<th>Mobile</th>
<th>email</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Id'] . "</td>";




Join the conversation! Your thoughts help the community grow.