Hi all,
I have a website which shows the distribution of surnames for various nations. Here's an example -
http://baz.perlmonk.org/surnames.cgi
The distributions are stored in a mysql table, and the maps are generated on the fly when a name is selected.
I was thinking about adding a form to this page to allow clients to add surnames which are not already included. To to do this, I could supply a text box form, and the user could enter their surname via this. The form would at this point hand over to a script, lets call it add_surname.cgi?surname=Griffin
Lets say this form has 2 parts. The first part acquires the data pertaining to this surname from an external source (for example, a CD containing electoral registrations), and fills a hash with this data, something like -
Name - Area - Number
Griffin - Dublin - 101
Griffin - Cork - 51
Griffin - Kerry - 514
Griffin - Clare - 445
Griffin - Derry - 0 (no Griffins in Derry, therefore no entry added to database for Griffin - Derry)
The second part then adds the data stored in the hash to the mysql database. So for the case above - Dublin, Cork, Kerry, Clare are added, and the number associated with them. As you can see, I therefore need to ensure that once the script is executed, it executes to completion, otherwise some of the entries might not be added to the database. How might I do this? Any other pitfalls you can think off? Two people trying to add the same surname simultaneously is already handled because add_surname.cgi first checks if an entry already exists for the surname in question. If so, add_surname.cgi terminates without adding anything.
Thanks,
Barry.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.