Retrieve the number of records in a table

How to know the number of results in a table ?

Each collector can call the method getCount used to count the number of records in a table.

 function getCount($conditions=array(), $sql = null) { }

Settings

  1. $conditions : a table which includes the conditions of recovery.
  2. $sql : an SQL query (string).

Example

The following example allows you to retrieve the number of records in the table "example" if the field "category" of the records has a value of "example".

$conditions = array('category' => 'example'); 
$result = $this->collector['example']->getCount($conditions);

The function's return

This method returns a number or NULL.