Loading everything into a hash for a web site program isn't working, I mean you could bring down a server fast doing that kind of thing. Besides, with mulitple users you have the problem of A messing with a seperate value table than B and then duplicates being created when you shove the hash back into the database.

Transactions are good if they are available and you want to deal with them.

What I do is get session_id's working and a unique identifier, grabing an MD5 of the current time in seconds is normally pretty good.

then build the table to keep user information seperate.

ie
create table sample( sample_id int not null auto_incrment primary key, session_id char(45) not null, item_num int, next2field int, .. blab blab );


To keep things fast I always place indexs on the session_id and primary key combination. This will speed things up enough that using a hash won't increase recall speed much faster.

With multiple users getting at your CGI this takes out the possibility that user 1, is adding duplicates to user 2 and so on. Also with the primary key, there is not a chance of a real duplicate record getting in there.

Of course all of this is based on the idea that you are only worried about a single user putting in duplicate data such as items in a shopping cart or account information. If you have global informtion that is not of the "single user" type, say dictionary information or bills paid with mulitple data entry, then you are back to transactions.

Man, did I get all talkitive or what? geez.. maybe just having "anyone" put stuff in here isn't all that good of an idea :-)

Hope this helps,

webadept.net

In reply to Re: simple MySQL prob by webadept
in thread simple MySQL prob by caesar

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.