First step : Create Database with the name multi_search.
Second step : Download from this Link To Download Database. And import to your database.
Third step : Create File with the name config.php in your PHP text editor, and copy this script :
<?php
$dbhost = ‘localhost’;
$dbuser = ‘root’;
$dbpass = ”;
$dbname = ‘multi_search’;
mysql_connect(“$dbhost”,”$dbuser”,”$dbpass”);mysql_select_db(“$dbname”) or error(mysql_error());
?>
Fourth step : Create File with the name search.php in your PHP text editor, and copy this script :
<form action=”result.php” method=”post” name=”search”
id=”search”>
<input type=”text” name=”search” id=”search”/>
<input type=”submit” name=”submit” id=”submit” value=”Find
Data!”/>
</form>
Fifth step : Create File with the name result.php in your PHP text editor, and copy this script :
<?php
include “config.php”;
if ((isset($_POST[‘submit’])) AND ($_POST[‘search’] <> “”))
{
$search = $_POST[‘search’];
$sql1 = mysql_query(“SELECT * FROM table1 WHERE detail LIKE ‘%$search%’ “) or die(mysql_error());
$total1 = mysql_num_rows($sql1);
if ($total1 > 0)
{
echo ‘<p>Data find ‘.$total1.’ in table one!</p>’;
while ($res1 = mysql_fetch_array($sql1))
{
//$num++; echo $num.’. ‘;
echo $res1[‘detail’].'<br>’;
}
}
else
{
$sql2 = mysql_query(“SELECT * FROM table2 WHERE detail LIKE ‘%$search%’ “) or die(mysql_error());
$total2 = mysql_num_rows($sql2);
if ($total2 > 0)
{
echo ‘<p>Data find’.$total2.’ in table two!</p>’;
while ($res2 = mysql_fetch_array($sql2))
{
//$num2++; echo $num2.’. ‘;
echo $res2[‘detail’].'<br>’;
}
}
else
{
$sql3 = mysql_query(“SELECT * FROM table3 WHERE detail LIKE ‘%$search%’ “) or die(mysql_error());
$total3 = mysql_num_rows($sql3);
if ($total3 > 0)
{
echo ‘<p>Data find ‘.$total3.’ in table three!</p>’;
while ($res3 = mysql_fetch_array($sql3))
{
//$num3++; echo $num3.’. ‘;
echo $res3[‘detail’].'<br>’;
}
}
else
{
echo “Data Not Found !”;
}
}
}
}
else
{
echo ‘Please put other keyword !’;
}
?>
In the end you can see the result in you browser.
Reblogged this on Dinesh Ram Kali..