where clause is a part of select command . it is used to fetch data from a table . we basically use this clause to filter out our results. by using where clause we can select particular set of records based specified condition.
create database name dbname
table name : empInfo
column : id , name , eid,mob
create connection.php page
<?php
$con=mysqli_connect("localhost","username","password","dbname") or die(mysqli_error());
?>
create index.php
<?php
include("connection.php");
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>page title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style4 { color: #0066CC;
font-weight: bold;
font-size: 16px;
}
-->
</style>
</head>
<body>
<?php
//select values from empInfo table where column=value
$data="SELECT * FROM empInfo where emp_id='devesh@gmail.com'";
$val=mysqli_query($con,$data);
echo "<table border='1'>";
echo "<tr><th>Emp_id</th><th>Name</th><th>Email</th><th>Mobile</th></tr>";
while(list($id,$name,$eid,$mob) = mysqli_fetch_array($val))
{
echo "<tr>";
echo "<td>".$id."</td>";
echo "<td>".$name."</td>";
echo "<td>".$eid."</td>";
echo "<td>".$mob."</td>";
echo "</tr>";
}
echo "</table>";
?>
<?php //}?>
</body>
</html>