|
Date: 2/8/2008 12:11 pm · Subject: SQLForm with unique field(s) · Rating: -1
I am creating an sqlform for a newsletter I am sending out, where users can signup with: Name and Email
I want the sqlform to check the email field in the database table , to see that is does not already exist.
I tried to manually make the database field Unique (from a mysql perspective), like this: alter table mailinglist change email email char(255) unique; It works fine from a mysql view, but when i enter none-unique values, I get a server error. THe best would perhaps be for the SQLForm to check on the field attributes in the database table and if its unique, check it against the submitted data before inserting. Is there any way to do what I am trying to do? Or should I tweak SQLform to check field attributes before inserts?
--- (Edited on 2/8/2008 12:11 pm [GMT-0600] by zylo) ---
--- (Edited on 2/8/2008 12:34 pm [GMT-0600] by zylo) ---
|