Need assistance with simple search when it has no results
I'm using a working simple text keyword search within a CMSB section. Search works great...and correctly. MY problem is that I don't know how to code the page for when there are no records found for the specific search.
The way it is right now I have a section called Inventory (for things like office equipment as an example), and of course I have a list page for the Inventory section. It is this list page that the search form POSTS to in order to display search results. Otherwise the list page is used to view all records in inventory, or some specific inventory records (like if a checkbox for 'used' or 'new' is used).
As I stated, the searching is working fine. My challenge is that the page is blank when no records are found. Is there a simple way to give the website visitor a cue that there are no records matching their search criteria?
Thanks in advance!
You'll have something like
<?php foreach ($inventoryRecords as $record): ?>
<?php endforeach ?>
Just at the end of that add;
<?php if (!$inventoryRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
Sorry mate - I'd need to understand more of the code - and I'm definitely no expert... maybe post the whole code?
Actually, Tim...er...I...uh...had yet ANOTHER brain fart! Maybe...JUST MAYBE...if...IF...I chose to include the CORRECT SECTION NAME - then maybe the code would work!! Doh!! Double doh!!
Sorry, bro. Thanks, again. It's all better...all working...correct simple code...with the correct section name used. Geez.
Lotsa love to you, though! Thanks!