Hi David,
For the below code, how can I limit the category to 10.
<?php
$sql = "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products` ORDER BY category";
if (database_querySelect($sql,$rows))
{
foreach($rows as $row)
{
if ($config_useRewrite)
{
$href = $config_baseHREF."category/".tapestry_hyphenate($row["category"])."/";
}
else
{
$href = $config_baseHREF."search.php?q=category:".urlencode($row["category"]).":";
}
print "<a href='".$href."'>".$row["category"]."</a><br />";
}
}
?>
thanks
jack
Hi David,
Thank you very much. It works fine.
regards
Jack
Hello Jack,
Simply add LIMIT 10 to the end of the SQL, for example:
$sql = "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products` ORDER BY category LIMIT 10";
Cheers,
David.