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..');
        }
    }