Hi fellow monks.

I'm currently working on a web site (community) that will need some kind of chatterbox/short messaging system. The idea of the chatterbox is to give the members that have logged in the opportunity to send short messages to each other. (Just like the perlmonks chatterbox). As I started to implant this to my community i ran into a problem:

Witch is the wisest way to store the messages in my DB?(MySQL v3.23.31)

I thought of just having a table for all messages with columns that hold the sender, receiver and the message. But then I realized that if the user where to delete a message the messages need some kind of unique id. I thought of just using the AUTO_INCREMENT option on my message id column, but since MySQL doesn't reuse numbers and these messages will be sent and deleted pretty often I would at some point run out of numbers. I know that I can use a really big INT to store the ID, but it still doesn't feel right.

Then i thought of just randomizing a ID (e.g Rd42dXf2). But that would force me to scan trough the table to see if the ID that I just randomly picked is in use, and that doesn't seem like a very speedy solution.

Now, since I'm kind of stuck. Any solutions or pointers in the right directions would be really helpful.

// Martin

In reply to Message storing problem. by Martin A

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.