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 leo - July 5, 2018 - edited: July 5, 2018

Hi,

Here is an example of mysql_count usage:

mysql_count('products', 'type = "' . $type . '"');

Let me know if you have any questions!

Thanks,

Leo - PHP Programmer (in training)
interactivetools.com