IF STATEMENTS THAT MEET MORE THAN ONE CONDITION - Aug 3rd, 2010


If you’ve got a table called “people and two fields “price” and “description” and you need a specific result
depending on whether there’s information in one, the other or both fields, you can approach it this way. Remember that
the operator “!” means not so !$record['price'] means that there’s no information in the price field.



<!-- If there’s no price and no description, just show the title. –>
<?PHP foreach ($peopleRecords as $record): ?>
<?PHP if (!$record['price'] && !$record['l_description']): ?><?PHP echo $record['title'] ?><?PHP endif ?>

<!-- If there’s no price, just a description , offer information only. –>
<?PHP if (!$record['print_price'] && $record['full_description']): ?><a href=”<?PHP echo $record['_link'] ?>”><?PHP
echo $record['title'] ?></a>Click the title for more information.<?PHP endif ?>">

<!-- If there’s a price and no description, ask for the sale. –>
<?PHP if ($record['price'] && !$record['description']): ?><a href=”<?PHP echo $record['_link'] ?>”><?PHP echo
$record['title'] ?></a>Click the title to buy.<?PHP endif ?>

<!-- If there’s a price and a description, offer information and ask for the sale. –>
<?PHP if ($record['price'] && $record[description']): ?><a href=”<?PHP echo $record['_link'] ?>”><?PHP echo
$record['title'] ?></a>Click the title the for more information or to buy.<?PHP endif ?>
<?PHP endforeach ?>



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service