in reply to database setup
(not tested -- look around for more info about the "on duplicate key update" syntax, and try it out).INSERT into forum (memberName,original) values (?,?) on duplicate key update forum set current=? where memberName=?
So, I guess this isn't really a perl question after all, but if you wanted a perl solution instead (e.g. if the DB engine you're using appears not to enforce the uniqueness constraint), the idea would be to do a select first on the "contest" table for the given memberName value; if that returns a non-empty value, update the "current" field for that row; otherwise, insert a new row.
(If the process involves doing everyone in a single pass, it would be better to pull all the existing names from the "contest" db and hold those in a hash, then do updates or inserts for the new information, depending on whether a given name exists in the hash.)
update: better yet, do as ysth says below.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: database setup
by ysth (Canon) on Jun 04, 2007 at 08:39 UTC |