<?

$theSearch = $_POST["mySearch"];


if($theSearch=="")
{
header("location:entersearch.php?error=1");	
	
}
else if(strlen($theSearch)>30)
{
header("location:entersearch.php?error=2");
}
else
{

	include "conninfo.php"; //database

	$query = "SELECT * FROM people WHERE surname like '$theSearch'";
	$result = mysqli_query($link, $query);


	$numrows = mysqli_num_rows($result);//get the row number

	if($numrows>0) //if something found
	{
		while($r = mysqli_fetch_array($result))
		{
		echo $r["id"]." ";
		echo $r["firstname"]." ";
		echo $r["surname"]." ";
		echo $r["starsign"];
		echo "<br>";
		}
	}
	else
	{
		echo "Nothing found";
	}
}
?>