mysql_connect("localhost","root") or die("not conected");
mysql_select_db("db_resolve") or die("not find the db");
$output = '';
//Logic Part
if(isset($_POST['search']))
{
$searchq = $_POST['search'];
$searchq = preg_replace("#[^0-9a-z]#i","",$searchq);
$query = mysql_query("SELECT * FROM scrb WHERE district LIKE '%$searchq%' OR PS_SCRB LIKE '%$searchq%' OR Supplier LIKE '%$searchq%'") or die("could not search!");
$count = mysql_num_rows($query);
if($count == 0)
{
$output = 'there was no search results!';
}
else
{
while($row = mysql_fetch_array($query))
{
$dist = $row['District'];
$ps = $row['PS_SCRB'];
$supl = $row['Supplier'];
$cntc = $row['Contact'];
$mob = $row['Mobile'];
$output .= '
'.$dist.' - '.$ps.' - '.$supl.' - '.$cntc.' - '.$mob.'
';
}
}
}
?>