mysql_count

3 posts by 2 authors in: Forums > CMS Builder
Last Post: July 5, 2018   (RSS)

By petrogus - July 5, 2018

Hi everyone,

I would like to use the mysql_count in order to appear different section depend of the number of the records per type,
I have created table named "products" and i use list "type" in order to filtering them.
if the sum of the records which filtered by type is 1 or more than 1.

i use this one
<?php $modelCount = mysql_count('products', 'type'); ?>
 <?php if ($modelCount == 1) { ?>
  section A
<?php } elseif($modelCount > 1) { ?>
 section B
<?php } ?>

example
model AA have type A --> view in section 1
and
model B and type B
model 2B and type B  --> View in section 2

Could you help me please !
petrogus

PetroGus

By petrogus - July 5, 2018

thank you Leo , it works great 

PetroGus