public function count($table = '', $where = '')
    {
        // if table name not pass
        if (!empty($table)) {
            if (empty($where)) {
                $this->sql = "SELECT COUNT(*) AS NUMROWS FROM `$table`;"; // create count query
            } else {
                $this->sql = "SELECT COUNT(*) AS NUMROWS FROM `$table` WHERE $where;";  // create count query
            }

            // pdo prepare statement
            $this->STH = $this->prepare($this->sql);

            try {
                if ($this->STH->execute()) {
                    // fetch array result
                    $this->results = $this->STH->fetch();
                    // close pdo
                    $this->STH->closeCursor();
                    // return number of count
                    return $this->results['NUMROWS'];
                } else {
                    self::error($this->STH->errorInfo());
                }
            } catch (\PDOException $e) {
                // get pdo error and pass on error method
                self::error($e->getMessage() . ': ' . __LINE__);
            }
        } else {
            self::error('Table name not found..');
        }
    }
public function count($table = '', $where = '')
    {
        // if table name not pass
        if (!empty($table)) {
            if (empty($where)) {
                $this->sql = "SELECT COUNT(*) AS NUMROWS FROM `$table`;"; // create count query
            } else {
                $this->sql = "SELECT COUNT(*) AS NUMROWS FROM `$table` WHERE $where;";  // create count query
            }

            // pdo prepare statement
            $this->STH = $this->prepare($this->sql);

            try {
                if ($this->STH->execute()) {
                    // fetch array result
                    $this->results = $this->STH->fetch();
                    // close pdo
                    $this->STH->closeCursor();
                    // return number of count
                    return $this->results['NUMROWS'];
                } else {
                    self::error($this->STH->errorInfo());
                }
            } catch (\PDOException $e) {
                // get pdo error and pass on error method
                self::error($e->getMessage() . ': ' . __LINE__);
            }
        } else {
            self::error('Table name not found..');
        }
    }
public function count ( $ table = '' , $ where = '' ) { // if table name not pass if ( ! empty ( $ table ) ) { if ( empty ( $ where ) ) { $ this -> sql = "SELECT COUNT(*) AS NUMROWS FROM `$table`;" ; // create count query } else { $ this -> sql = "SELECT COUNT(*) AS NUMROWS FROM `$table` WHERE $where;" ; // create count query } // pdo prepare statement $ this -> STH = $ this -> prepare ( $ this -> sql ) ; try { if ( $ this -> STH -> execute ( ) ) { // fetch array result $ this -> results = $ this -> STH -> fetch ( ) ; // close pdo $ this -> STH -> closeCursor ( ) ; // return number of count return $ this -> results [ 'NUMROWS' ] ; } else { self :: error ( $ this -> STH -> errorInfo ( ) ) ; } } catch ( \ PDOException $ e ) { // get pdo error and pass on error method self :: error ( $ e -> getMessage ( ) . ': ' . __LINE__ ) ; } } else { self :: error ( 'Table name not found..' ) ; } }
Get Total Number Of Records in Requested Table.

@param string $table
@param string $where

@return number
Get Total Number Of Records in Requested Table .