[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Detecting duplicate values in a database
On Tue, Sep 10, 2002 at 11:00:34AM -0400, Mike Heins wrote:
> Quoting Michael (mslack@g1.slackford.com):
> > I have run into a bit of a problem using a form to update a database.
> >
> > I have one column in userdb that really needs to be a unique value on
> > a record by record basis. However it will not really be used as a key - it
> > simply cannot have duplicates.
>
>
> It would be easy to gen this up yourself.
>
> [set valid_form]
> [tmp ref_num_used][strip]
> [query sql="select ref_num from userdb where ref_num = '[cgi ref_num]'"]
> [sql-code]
> [/query]
> [/strip][/tmp]
> [if scratch ref_num_used]
> [calc]
> delete $CGI->{ref_num};
> [/calc]
> ref_num=mandatory Value in use - Select another
> [/if]
> [/set]
>
> Not tested, but you should get the idea.
Ginned up something quite close to the above... Success!
Thanks for the slap upside the head ;-) and thanks for your time!
Michael