Thursday, 30 May 2019

Use Of MySQL Where Clause in php 7.3

The WHERE clause is used to extract only those records that fulfill a specified condition.
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>



1 comment:

  1. Useful article, thank you for sharing the article!!!

    Website: blogcothebanchuabiet.com chia sẻ những câu nói mỉa mai người khác hay stt một mình vẫn ổn và giải thích hiện tượng chim sẻ bay vào nhà là điềm gì.

    ReplyDelete