Hi David
I have implemented the filter hack that I found you posted on some other post..
$sql = "SELECT DISTINCT brand FROM `".$config_databaseTablePrefix."products` WHERE category = '".database_safe($parts[1])."' LIMIT 10";
if (database_querySelect($sql,$rows))
{
print_r($rows);
echo "<div class='headleft'>Filter by Brand </div>";
echo "<ul>";
foreach($rows as $row)
{
$brandHREF = $config_baseHREF."search.php?q=".urlencode($q)."&brandFilter=".urlencode($row["brand"]);
echo "<li><a href='".$brandHREF."'>".$row["brand"]."</a></li>";
}
echo "</ul>";
}
The issue is it is still displaying the Filter box even though the query returns 0 rows.
Printing out the Rows array shows: Array ( [0] => Array ( [brand] => ) )
So brand is still returning with a blank item in therefore passing the if() statement..
Any help?
yea that solved it..
Heard somewhere that it is faster to us != than <>
Hi Andrew,
Adding a WHERE clause to exclude the empty brand should do the trick...
$sql = "SELECT DISTINCT brand FROM `".$config_databaseTablePrefix."products` WHERE category = '".database_safe($parts[1])."' AND brand <> '' LIMIT 10";
Cheers,
David.