in reply to Hash Value Part 2

Well, hmmm ... you're using the hash values correctly where you use them, but this isn't exactly ANSI compliant SQL you're using in spots. You also appear to be using DBI, but not in a consistent fashion. This not being SQL monks, some of what you'll need to know isn't readily available on this site; get (buy, or borrow) a book on basic SQL.

I'll let you in on one of the neatest things about DBI, though: placeholders. Their use is well documented in the DBI documentation, which you should read in addition to any materials on SQL you tackle. Basically, you can prepare a statement once, and execute it many times while filling in different values on each execution.

Rather than just feed you the code, on this occasion I'm going to point to the Tutorials page (me do that? yes!) and especially to the DBI section thereof.

HTH!