Jump to content

When i make search nothing appears


jhuna122

Recommended Posts

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>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.