Re: Is this the best way?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dan Joseph wrote:
>> I am attempting to add a little error checking for a very simple login
>> system. The info is stored in a MySQL database, and I am using mysqli
>> to connect to it. I have it working with the solution provided below,
>> but I am wondering if this is the right way to do it or if there is a
>> better way?
>>
>>
>>
> I don't see anything wrong with that method.  One thing I would suggest is
> that you make username unique in your database if you want to avoid
> duplicate results.  But your way of checking is just fine as it is.
> 
To go along with this and making sure that usernames are unique, I would
LIMIT 1 on the query.  With no LIMIT, if you have 300,000 users, then
the query will not stop if it matches the first user, it searches all
300,000.  With LIMIT 1 it will stop on the first match.

-Shawn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux