Hi, this script wont show the result from my data base and i dont know why it might be here
if ($x==1)
$construct .= " description LIKE '%$search_each%'";
else
$construct .= " AND description LIKE '%$search_each%'";
i tried to change the description to other to another column like location but no luck.
<?php
include ('connect.php');
$button = $_GET['submit'];
$search = $_GET['search'];
if (!button)
echo "you didnt submit a keyword.";
else
{
if (strlen($search)<=2)
echo "search term to short.";
else
{
echo " You searched for <b>$search</b><hr size='1'>";
//connect to our database
$search_exploded = explode(" ",$search);
foreach($search_exploded as $search_each)
{
// construct query
$x++;
if ($x==1)
$construct .= " description LIKE '%$search_each%'";
else
$construct .= " AND description LIKE '%$search_each%'";
}
// echo out construct
$construct = "SELECT * FROM flats WHERE $construct";
$run = mysql_query($construct);
$foundnum = mysql_num_rows($run);
if (foundnum==0)
echo "No results found.";
else
{
echo "$foundnum result found!<p>";
while ($runrows = mysql_fetch_assoc($run))
{
// get data
$select = $runrows['type'];
$title = $runrows['title'];
$location = $runrows['location'];
echo "
echo $title;
echo <br>;
echo $select;
echo <br>;
echo $rent;
echo <br>;
echo $location;
echo <hr>";
}
}
}
}
?>