Hello
I think using UNIQUE is the way to go simply because of data integrety (=
how do you spell this??? ; ) ) If you don't use UNIQUE and you are not
write locking your table you might accidently get duplicate Values. UNIQUE
is the only way to prevent duplicate data without a lot of hassle.
What I would do would instead be to put an
index on that column, then with a simple select
check if that username is free or not. Based on
what I get in return I can then either insert the
data or return the form to the visitor with information
about it. Much more simple in the long run.
I
Radwan Aladdin wrote:
Hello..
I want to prevent mySQL from storing the same value in a specified field (Username).. so how can I do it?
Regards..
Make it field UNIQUE.
Best
Bao
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Subject: Re: [PHP] How to prevent duplicated values?
Radwan Aladdin wrote:
Hello..
I want to prevent mySQL from storing the same value in a specified field
(Username).. so how can I do it?
Regards..
Make it field UNIQUE.
Best
Bao
--
PHP General Mailing List (http://www.php.net
BAO RuiXian wrote:
Radwan Aladdin wrote:
I want to prevent mySQL from storing the same value in a
specified field (Username).. so how can I do it?
Make it field UNIQUE.
That's the easy method, but usually not very smart. It only causes MySQL to
generate an error which you then have to take
Radwan Aladdin wrote:
But I'm using VB OCX file to show the result... I tried the UNIQUE
and it worked greate! So do you mean I should use other ways?
If it works, then great.
The problem, as I can see it, is if you have a form where a user applies for
a user account (I assume that since the
Thomas Svenson wrote:
BAO RuiXian wrote:
Make it field UNIQUE.
That's the easy method, but usually not very smart. It only causes MySQL to
Well, if there is an easy method, why we bother to use a more
complicacted way?
generate an error which you then have to take care of in your
7 matches
Mail list logo