pls advise - Issue with no records found query

2 posts by 2 authors in: Forums > CMS Builder
Last Post: December 18, 2020   (RSS)

By thenetgirl - December 15, 2020

I need a bit of help please ... I have a section on home page and separate rental pages  to display Available: NOW rental listings. 

gormanre.exedor.us/RentalList.php

gormanre.exedor.us/property-currently-rented.php

----------------------------------------

Available:  NOW  or  Property Currently Rented

Either check - DISPLAYS a page of properties .

I need a bit of help please with this query the checkbox one is always clicked  with one choice or the other

<?php foreach ($rentalsRecords as $record): ?>

<?php if (!stristr($record['available'], "\t"."NOW"."\t")) { continue; } ?>

<?php if (!$rentalsRecords): ?>
No records were found!<br><br>
<?php endif ?>
<!-- /STEP2: Display Records -->

However when there is no properties checked for Available ---NOW 

I want to put in a nice display for the NO records found
...but I can not get it to work no matter which way I do it? 

I have tried to even put the whole thing inside the all together and by itself  <?php foreach ($rentalsRecords as $record): ?>  - didnt work

Tried this wont load the page at all gives me  lots of errors

<?php if (!$rentalsRecords['available'], "\t"."NOW"."\t") ): ?>
No records were found!<br><br>
<?php endif ?>
<!-- /STEP2: Display Records -->

and  this in a variety different ways

<?php if (!$rentalsRecords['available'], "\t"."NOW"."\t" == "0"): ?>
No records were found!<br><br>
<?php endif ?>

Please advise I am losing my mind???

Patricia

www.thenetgirl.com

By Jenna - December 18, 2020

Hi Patricia,

I think you have the code almost right, you are just missing a PHP function. (stristr) Your code is below:

<?php if (!$rentalsRecords['available'], "\t"."NOW"."\t") ): ?>
No records were found!<br><br>
<?php endif ?>

And I think it should be:

<?php if (!stristr($rentalsRecords['available'], "\t"."NOW"."\t") ): ?>
No records were found!<br><br>
<?php endif ?>

Please let me know if this helps.

Jenna Cooke - PHP Programmer
interactivetools.com