public function count($table, $where = array(), $cache = true) {
        $this->sql = sprintf("SELECT count(*) FROM `%s`%s;", SafeString::makeSafe($table), $this->where($where));
        $this->key = md5($this->database.$this->sql.serialize($this->values));
        
        $result = $this->executeQuery($cache);
        if(!$result) {
            $result = $this->query->fetchColumn();
            if($cache && $this->cacheEnabled) {$this->setCache($this->key, $result);}
        }
        return $result;
    }
public function count($table, $where = array(), $cache = true) {
        $this->sql = sprintf("SELECT count(*) FROM `%s`%s;", SafeString::makeSafe($table), $this->where($where));
        $this->key = md5($this->database.$this->sql.serialize($this->values));
        
        $result = $this->executeQuery($cache);
        if(!$result) {
            $result = $this->query->fetchColumn();
            if($cache && $this->cacheEnabled) {$this->setCache($this->key, $result);}
        }
        return $result;
    }
public function count ( $ table , $ where = array ( ) , $ cache = true ) { $ this -> sql = sprintf ( "SELECT count(*) FROM `%s`%s;" , SafeString :: makeSafe ( $ table ) , $ this -> where ( $ where ) ) ; $ this -> key = md5 ( $ this -> database . $ this -> sql . serialize ( $ this -> values ) ) ; $ result = $ this -> executeQuery ( $ cache ) ; if ( ! $ result ) { $ result = $ this -> query -> fetchColumn ( ) ; if ( $ cache && $ this -> cacheEnabled ) { $ this -> setCache ( $ this -> key , $ result ) ; } } return $ result ; }
Count the number of return results
@param string $table The table you wish to count the result of
@param array $where Should be the field names and values you wish to use as the where query e.g. array('fieldname' => 'value', 'fieldname2' => 'value2', etc).
@param boolean $cache If the query should be cached or loaded from cache set to true else set to false
@return int Returns the number of results
Count the number of return results