SPUG: Using a Duplicate Value Error Message

Will Kidwell will at marketproductions.com
Mon Mar 19 18:53:37 PDT 2007


Am new to list, so I just wanted to say hello and post my first question. :)

I am writing a simple script right now (attached) to allow people to register usernames/passwords into a MySQL DB.

The script works, but in the "make_handle" subroutine, which inserts the username/passwords input to the DB, I am trying to figure out what to do if the proposed handles already exist.  How do I notify the user of the error and to try again?

The error would occur around line 120 of the script.  Somehow I'm going to have to initialize a variable and set it into a conditional that will allow me to post a "Success" or "Try again" statement, but I'm not sure how to do so.  I've got RaiseError working, and it might be possible to use it somehow to set a variable equal to 1 for "Try Again" or "0" for "Success", but if thats the answer I'm still not sure of how to write it out.

Can anyone give me some pointers here?  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/spug-list/attachments/20070319/8395525d/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: handles.pl
Type: application/octet-stream
Size: 2963 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/spug-list/attachments/20070319/8395525d/attachment.obj 

More information about the spug-list mailing list