public function table_exists($table) {

        // if table argument contains the database name, extract it
        if (strpos($table, '.') !== false) list($database, $table) = explode('.', $table);

        // check if table exists in the database
        return is_array($this->fetch_assoc($this->query('SHOW TABLES' . (isset($database) ? ' IN ' . $database : '') . ' LIKE ?', array($table))));

    }