MCPcopy Create free account
hub / github.com/EqualifyEverything/equalify / count_db_rows

Method count_db_rows

models/db.php:586–605  ·  view source on GitHub ↗

* Count DB rows * @param string table * @param array filters [ array ( * 'name' => $name, 'value' => $value, 'page' => $page) ] */

(
        $table, $filters = []
    )

Source from the content-addressed store, hash-verified

584 * 'name' => $name, 'value' => $value, 'page' => $page) ]
585 */
586 public static function count_db_rows(
587 $table, $filters = []
588 ){
589
590 // SQL
591 $sql = 'SELECT COUNT(*) AS TOTAL FROM `'.$table.'`';
592 $params = array();
593
594 // Add optional filters.
595 $filters = self::filters($filters);
596 $sql.= $filters['sql'];
597
598 // Query
599 $results = self::query($sql, $filters['params'], true);
600
601 // Result
602 $data = $results->fetch_object()->TOTAL;
603 return $data;
604
605 }
606
607 /**
608 * Get Meta Value

Callers 2

index.phpFile · 0.80

Calls 2

filtersMethod · 0.95
queryMethod · 0.95

Tested by

no test coverage detected