Hi David,
I cant get the topsearches to work
This is my code, which is implemented direct on index.php
print "<div class='boxtopsearch'>";
print "<p>Top Searches</p>";
print "<ul>";
$sql = "SELECT * FROM querylog ORDER BY count DESC LIMIT 10";
if (database_querySelect($sql,$rows))
{
foreach($rows as $row)
{
$url = $config_baseHREF."search.php?q=".urlencode($row["query"]);
print "<li><a href='".$url."'>".$row["query"]."</a></li>";
}
}
print "</ul>";
The querylog is in the database and is gathering the searches, but i cant get it to display
Do you have an idea?
regards,
B.
Hi David,
I dont use a tableprefix. I had a look and tested it to be sure, but that isn't the case.
regards,
B.
Hi B.
Can you double check that the non-database part of the code is working correctly, by browsing to your home page and then using your browser's View > Source menu, then look in the source for <div class='boxtopsearch'>
which will ensure that it is being included - and then whilst there check whether you might also be able to see the Top Searches output, which would indicate that it is working but CSS or some other aspect of your home page layout is preventing it from being visible.
If still no joy, set $config_databaseDebugMode to TRUE in config.advanced.php and run the code again just in case there is a subtle database error associated with the code...
Cheers,
David.
--
PriceTapestry.com
Hi David,
Thank you for the support. In debug mode i found out that i was missing the count table in the database. Working fine now!
B.
Hi B.
Does your installation use a $config_databaseTablePrefix value? The code above looks fine, so I am wondering if this line:
$sql = "SELECT * FROM querylog ORDER BY count DESC LIMIT 10";
...should be:
$sql = "SELECT * FROM `".$config_databaseTablePrefix."querylog` ORDER BY count DESC LIMIT 10";
Cheers,
David.
--
PriceTapestry.com