i wish to add code that is only shown when there is no results
the code will contain the search phase used, can you advise??
strange, this is where i had added the code, but it never appears on the page no matter what??
That's strange - it's included here, in search.php:
<?php
if ($searchresults["numRows"])
{
require("html/searchresults.php");
}
else
{
require("html/noresults.php");
}
?>
Can you do a print_r on $searchresults to try and see what's happening, and post the contents. You can do it like this:
<?php
print_r($searchresults);exit();
if ($searchresults["numRows"])
{
require("html/searchresults.php");
}
else
{
require("html/noresults.php");
}
?>
That will dump the contents and exit the script. It should help figure out why $searchresults["numRows"] is not zero, and hense including the searchresults HTML module instead of noresults.
Cheers,
David.
Strange my search.php did not have that, so this is what i have done
<?php
// if (isset($searchresults)) require("html/searchresults.php");
if ($searchresults["numRows"])
{
require("html/searchresults.php");
}
else
{
require("html/noresults.php");
}
?>
Hi,
There is an existing HTML module for display when there are no results, which currently contains no code...
html/noresults.php
You can access the normalised query via the variable $q (that's the awkward characters removed version), or if you want to use the exact text that was enetered by the user you can use $_GET["q"]. For example:
<?php
print "You searched for ".$_GET["q"];
?>
Cheers,
David.