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 care of in your application. Much better to have an index on the Username column and then use a select to check if the name exist. If it doesn't it is OK to insert. Much easier to handle in PHP. Personally I avoid using such things as UNIQUE or NOT_NULL (unless the column have a default value) on columns, just because it is more complex to handle the MySQL errors than write your own code to check it in PHP. /T -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php