How to check mysql results are empty or not. if mysql query results are empty then else condtion should not be excueted. In case mysql results data there & in else condition my error my message are there but it is not showing any error message. I have tried following code but not showing any alert or echo message on screen.
<?php
$sql = "select * from hall_search_data_1 where rent BETWEEN '".$_SESSION['amount1']."' AND '".$_SESSION['amount2']."'";
$res = mysql_query($sql);
if(!empty($res)){
while($row=mysql_fetch_row($res))
{
// here my data
}
}else{
echo "no results found";
echo "<br>";
echo "<script>alert('No any result found..!!');</script>";
echo "no results found";
}
?>
you can just replace
if(!empty($res))
with mysql_num_rows like this -