<?php
include 'connect.php';
$stfind = $_GET['startup_find'];
$sqlselect = "SELECT * from startup_schema where Name = '$stfind'";
$comments = mysqli_query($mysqli, $sqlselect);
$mysql_num_rows = mysqli_num_rows($comments);
while ($row = mysqli_fetch_array($comments)) {
if($mysql_num_rows > 0) {
echo "<table border='1' style='width: 100%'>";
echo "<tr>"; // LINE ADDED
echo "<th>ID</th>";
echo "<td>" . $row['ID'] . "</td>";
echo "</tr>";
echo "<tr>";
echo "<th>Name</th>";
echo "<td>" . $row['Name'] ."</td>";
echo "</tr></table>";
} else {
echo "No Data Found.";
}
}
mysqli_close($mysqli);
?>
Here is my PHP! my connect.php has connection to database. Everything is working fine till if statement but the if the rows does not exist the program is not executing the else statement.