Hello all,
I've ran into a bit of a problem and I can't figure out how to get out of it.
Basically, I have an autosuggest input field on my website and I would like to get data from 2 mysql tables.
It is similar to yell.com where you search for your "keyword" or "company name" and it all gets returned.
www.whatslocaltome.co.uk is the website. You can see my autosuggest box at the top (Keyword)... I want it to return either towns or company names...
Code so far:
$sql_res=mysql_query("select * from directory_categories where `category` like '%$q%' order by id LIMIT 5");
if($sql_res > 0){
while($row=mysql_fetch_array($sql_res))
{
$kw=$row['category'];
?>
<div class="display_box" align="left">
<a href="" onClick="document.forms['searchform'].keyword.value = '<?php echo $kw; ?>'; return false;" id="resultsclose" onclick="fill();" >
<?php
echo $kw;
?>
</a>
</div>
<?php
}
}
elseif(!$sql_res) {
?>
<div class="display_box" align="left">
<?php
echo "No suggestion";?>
</div>
<?php
}
}
else
{
}
?>