public Map<String, String> ReadMsg(int msg_id) {
        Map<String, String> map = null;
        String query = String.format("select msg.msg_id as msg_id, u.user_id as user_id," + " aut.username as username, message_subject, message_text" + " from %1$sprivmsgs_to msgto" + " left join %1$susers aut on msgto.author_id = aut.user_id" + " left join %1$sprivmsgs msg on msgto.msg_id = msg.msg_id" + " left join %1$susers u on msgto.user_id = u.user_id"
                + " where pm_unread = 1 and lower(u.username) like lower(?)", db_prefix);
        if (msg_id != 0) {
            query += " and msgto.msg_id = ?";
        }
        query += " order by message_time desc limit 1";
        try {
            PreparedStatement ps = conn.prepareStatement(query);
            ps.setString(1, player);
            if (msg_id != 0) {
                ps.setInt(2, msg_id);
            }
            ResultSet result = ps.executeQuery();
            String[] keys = { "username", "message_subject", "message_text" };
            if (result.next()) {
                map = new HashMap<String, String>();
                for (String key : keys) {
                    map.put(key, result.getString(key));
                }
                int user_id = result.getInt("user_id");
                msg_id = result.getInt("msg_id");
                ps.close();
                if (map != null && map.size() > 0) {
                    conn.setAutoCommit(false);

                    query = String.format("update %sprivmsgs_to set pm_unread = 0 where msg_id = %d", db_prefix, msg_id);
                    Statement st = conn.createStatement();
                    st.executeUpdate(query);

                    query = String.format("update %susers", db_prefix) + " set user_new_privmsg = case when user_new_privmsg > 0 then" + " user_new_privmsg - 1 else 0 end," + " user_unread_privmsg = case when user_unread_privmsg > 0 then" + " user_unread_privmsg - 1 else 0 end where user_id = " + user_id;
                    st = conn.createStatement();
                    st.executeUpdate(query);

                    conn.commit();
                    st.close();
                    conn.setAutoCommit(true);
                }
            }
            return map;
        } catch (SQLException ex) {
            try {
                conn.rollback();
                conn.setAutoCommit(true);
                this.log.info("[phpbbpm] Error updating new pm number" + ex.getMessage());
            } catch (SQLException ex1) {
                this.log.info("[phpbbpm] rollback error. ex: " + ex.getMessage());
            }
            log.log(Level.WARNING, "[phpbbpm] Error getting unreaded message of " + player);
        }
        return null;
    }