code/libraries/joomlatools/library/database/table/abstract.php
public function count($query = null, array $options = array())
    {
        //Count using the identity column
        if (is_scalar($query))
        {
            $key = $this->getIdentityColumn();
            $query = array($key => $query);
        }

        //Create query object
        if (is_array($query) && !is_numeric(key($query)))
        {
            $columns = $this->mapColumns($query);
            $query = $this->getObject('lib:database.query.select');

            foreach ($columns as $column => $value)
            {
                $query->where($column . ' ' . (is_array($value) ? 'IN' : '=') . ' :' . $column)
                    ->bind(array($column => $value));
            }
        }

        if ($query instanceof KDatabaseQuerySelect)
        {
            if (!$query->columns) {
                $query->columns('COUNT(*)');
            }

            if (!$query->table) {
                $query->table(array('tbl' => $this->getName()));
            }
        }

        $result = (int)$this->select($query, KDatabase::FETCH_FIELD, $options);
        return $result;
    }
public function count($query = null, array $options = array())
    {
        //Count using the identity column
        if (is_scalar($query))
        {
            $key = $this->getIdentityColumn();
            $query = array($key => $query);
        }

        //Create query object
        if (is_array($query) && !is_numeric(key($query)))
        {
            $columns = $this->mapColumns($query);
            $query = $this->getObject('lib:database.query.select');

            foreach ($columns as $column => $value)
            {
                $query->where($column . ' ' . (is_array($value) ? 'IN' : '=') . ' :' . $column)
                    ->bind(array($column => $value));
            }
        }

        if ($query instanceof KDatabaseQuerySelect)
        {
            if (!$query->columns) {
                $query->columns('COUNT(*)');
            }

            if (!$query->table) {
                $query->table(array('tbl' => $this->getName()));
            }
        }

        $result = (int)$this->select($query, KDatabase::FETCH_FIELD, $options);
        return $result;
    }
public function count ( $ query = null , array $ options = array ( ) ) { //Count using the identity column if ( is_scalar ( $ query ) ) { $ key = $ this -> getIdentityColumn ( ) ; $ query = array ( $ key => $ query ) ; } //Create query object if ( is_array ( $ query ) && ! is_numeric ( key ( $ query ) ) ) { $ columns = $ this -> mapColumns ( $ query ) ; $ query = $ this -> getObject ( 'lib:database.query.select' ) ; foreach ( $ columns as $ column => $ value ) { $ query -> where ( $ column . ' ' . ( is_array ( $ value ) ? 'IN' : '=' ) . ' :' . $ column ) -> bind ( array ( $ column => $ value ) ) ; } } if ( $ query instanceof KDatabaseQuerySelect ) { if ( ! $ query -> columns ) { $ query -> columns ( 'COUNT(*)' ) ; } if ( ! $ query -> table ) { $ query -> table ( array ( 'tbl' => $ this -> getName ( ) ) ) ; } } $ result = ( int ) $ this -> select ( $ query , KDatabase :: FETCH_FIELD , $ options ) ; return $ result ; }
Count table rows

@param   mixed $query    KDatabaseQuery object or query string or null to count all rows
@param   array $options  An optional associative array of configuration options.
@return  int   Number of rows
Count table rows