my search engine
Posted: Sun Apr 04, 2010 11:22 am
I recently made a small search engine using php&mysql and i have reached an error, every time i click the "search" button it just displays half of my search.php code.
this is what i have for search.php:
and i dubble checked all the sql dump is there.pliz help
this is what i have for search.php:
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>
";
}
}
}
?>