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 column name is Username) and you then query MySQL to add the data to the table. If that user name already exist, MySQL will give an error saying that it can't insert since there is already a row with that name. You will have to handle this and then tell the new user that the name he wants already is taken. 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. Also this will put you in charge of fault handling and not the database. Remember that PHP just send/receive data to/from MySQL. It can't interpret error messages MySQL outputs. Therefore I prefer to check things like this myself. It is pretty easy to write global functions that then can be used in many places for this instead of handling the error messages from MySQL. /T -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php