Hi guys…Very new to PHP so please bear with me.
I have a section of code in our files that i want to only show if the actual database has entries in that category.
We run a dog rescue website and have 3 categories of dogs for adoption…Male/Female/Couples.
We will always have Male and Female dogs for adoption but not always couples for adoption. So what i would like to do is only show the category “Couples” if there are dogs in it.
The code i have at present is :-
[php]
Couples For Adoption
-
<?php foreach($foliorow as $frow):?>
<?php $url = ($core->seo == 1) ? $core->site_url . '/' . $frow['slug'] . '.html' : $core->site_url . '/modules.php?module=portfolio&do=portfolio&productname=' . $frow['slug'];?>
<?php if (( $frow['catname'] == "Reserved") || ($frow['catname'] == "Coming soon")) : ?>
<?php
else:
if ( $frow['sex'] == 2) : ?>
-
<?php echo $frow['title'.$core->dblang];?>
<?php endif; endif; endforeach;?><div><?php echo cleanSanitize($frow['short_desc'.$core->dblang],100);?></div> </div>
“Sex” is obviously the category, in this case being “2”.
Is there a way to only display this category if there are any dogs in it and to hide it if the query produces no results?
Thanks guys…Look forward to your reply