Whenever i search in my search.php it doesn't show any result, it remains blank without any search from my database table. I am really in a big trouble as my mind getting hang. Please help me to correct or need to solve whatever problem is and thanks in advance
Here is the search.php page code.
<?php
$output = NULL;
if(isset($_POST['submit'])){
$mysqli = NEW MySQLi("localhost","root","","inventory");
$search = $mysqli->real_escape_string($_POST['search']);
$resultSet = $mysqli->query("SELECT * FROM invlist WHERE asset_num = '$search'");
if($resultSet->num_rows > 0){
while($rows = $resultSet->fetch_assoc())
{
$sn = $rows['sn'];
$asset_num = $rows['asset_num'];
$output = "Serial Number: $sn<br />Asset Number: $asset_num";
}
}else{
$output = "No results";
}
}
?>
<form method="POST" action="search.php">
<input type="TEXT" name="search" />
<input type="SUBMIT" name="submit" value="Search" />
</form>