Facing issue while retrieving data from table using select command with where clause. my code is as below
if(isset($_POST[‘dcode’]))
{
$dcode = $_POST[‘dcode’];
if(empty($dcode))
{
$dcode = ‘ALL’;
}
}else {
$dcode = ‘ALL’;
}
$db = mysqli_connect(‘localhost’, ‘root’,’’,‘mydb’);
if(!$db)
{
print "
Unable to Connect to MySql ";
}
print "
Connected to database “.$dcode.”";
$sql_statement = “SELECT NEIS, NAME, DESIGN, GRADE, DCODE, UNIT, DOA, DOPP1, DOPP2, DOPP3, DOPP4 FROM wani1”;
if($dcode !=‘ALL’)
{
$sql_statement .= “WHERE DCODE = '”.$dcode."’";
}