<?include "conninfo.php";//connection
$search=$_POST["mysearch"];//get from form

$query="SELECT * FROM people WHERE surname like '$search'
OR firstname like '$search'";

$result=mysqli_query($link,$query)or die(mysqli_error());

$numrows=mysqli_num_rows($result);//how many rows found?

echo "Records found: ".$numrows."<br><br>";

if($numrows>0)//if there were some rows, print out
{
	while($r=mysqli_fetch_array($result))
	{
	echo $r["id"]." ";
	echo $r["firstname"]." ";
	echo $r["surname"]." ";
	echo $r["favfood"]."<br>";
	}
}
else
{
	echo "Sorry! Try again!";
}



?>