half of my search.php code. here is the search.php code:
Code: Select all
<php?
session_start();
include "connect.php";
$button = $_GET['submit'];
$search = $_GET['search'];
{
if (!$button)
echo "You didn't submit a keyword.";
}
else
{
if (strlen($search)<=2);
echo "Search term too short.";
else
{
echo "you searched for <b>$search</b> <hr size='1'>";
mysql_connect("localhost","root","")
mysql_select_db("asearch");
{
$search_exploded = explode(" ",$search);
foreach($search_exploded as $search_each)
{
$x++;
if ($x=1)
$construct .= "keywords LIKE '%$search_each%'";
else
$construct .= "OR keywords LIKE '%$search_each%'";
}
{
$construct = "SELECT * FROM asearch WHERE $construct";
$run = mysql_query($construct):
if mysql_num_rows($run)=0)
ehco "No results found";
else
}
echo "$foundnum results found!<p>";
while ($runrows = mysql_fetch_assoc($run))
{
$title = $runrow['title'];
$desc = $runrow['description'];
$url = $runrow['url'];
echo "
<b>$title</b><br>
$desc<br>
<a href-'$url'>$url<p>
";
}
}
}
?>