This course will be retired on June 1, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
We need to handle an empty result list, when there are no items that match the search term. We also want them to know we are on the search results page as well as the search term they used. Letβs take a look at the finished results.
Example Code
if ($search != null) {
echo "Search Results for \"".htmlspecialchars($search)."\"";
}
if ($total_items < 1) {
echo "<p>No items were found matching that search term.</p>";
echo "<p>Search Again or "
. "<a href=\"catalog.php\">Browse the Full Catalog</a></p>";
}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up