RE: [PHP] How to prevent duplicated values?
| From: | Ralph Guzman | Date: | Tue, 27 Jan 2004 22:12:19 +0000 |
| Subject: | RE: [PHP] How to prevent duplicated values? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-175982@lists.php.net to get a copy of this message | ||
>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 don't see how this method is simpler than querying the table to see if
user name exists then returning true or false. Either way you are inserting
the data or returning and error to be displayed on the form.