If a record exist
Sorry for my stupid question: i would like to have a certain behaviour if "reviewRecord" exists, and another behaviour if reviewRecord doesn't exist. How can i make this?
Thank you in advance for your help
If statements can offer this kind of results you're looking for.
So if you're looking for a simple "no records found" vs "records are found" indicator, you can try something like this on your page after any searching criteria results:
<?php if (!$your_sectionRecords): ?>
No records were found!<br/><br/>
<?php elseif ($your_sectionRecords) : ?>
Record(s) were found!<br/><br/>
<?php endif ?>
There are many othre examples of using if statements both here on the forum and in my CMSB Cookbook http://www.thecmsbcookbook.com
Hope that helps.
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Thank You Jerry! But it doesn'work for me.
I have this code
list($reviewRecords, $reviewMetaData) = getRecords(array(
'tableName' => 'review',
'where' => 'restaurant = ' . getNumberFromEndOfUrl(),
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',
$reviewRecord = @$reviewRecords; // get first record
So i would like to have "no records found" 'where' => 'restaurant = ' . getNumberFromEndOfUrl(),
Any suggestions about this?