Jump to content

How would I go about adding filters to my Full-Text search code?


virtuexru

Recommended Posts

OK. So I want to add some filters to my search, such as choosing a category to be searched in or a certain city.

How would I go about doing that. I have this code so far:

[code]

<?php
$keyword = $_POST['keyword'];

$searchdb = "
SELECT *,
MATCH(title, description, location, category) AGAINST('$keyword') AS score
FROM joborder
WHERE MATCH(title, description, location, category) AGAINST('$keyword')
ORDER BY score DESC";
$rest = mysql_query($searchdb);
?>

<table width="100%" border="0" cellspacing="0" cellpadding="2">
<?php

if (!$rest)
{ echo mysql_error(); }
while($row = mysql_fetch_array($rest)) {
$url = 'http://www.x.com/viewlog.php?id='.$row['number'].'';
$html = '<a href="'.$url.'">'.$row['title'].'</a>';

echo "<tr bgcolor=\"#99CCFF\"><td><b>{$html}</b></td>";
echo "<td>{$row['location']}</td></tr>";
echo "<tr bgcolor=\"#CCCCCC\"><td>{$row['description']}</td>";
echo "<td>{$row['salary']}<br/></td></tr>";
echo "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>";
}
echo "</table>";
?>


[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.