Welcome Guest, Not a member yet? Register   Sign In
Username And Email Login Form Validation Question
#6

(04-13-2017, 12:28 AM)Diederik Wrote: Why? Because of performance.

I believe it's best practice to make as simple sql queries as possible. I you can get rid of a OR statement in your query with a few lines of php I believe it's woth it anytime.

Compare using
Code:
SELECT id,username,email,salt FROM users WHERE email='PostData' LIMIT 1
(Or if you determine 'PostData' is not a valid emailaddress)
Code:
SELECT id,username,email,salt FROM users WHERE username='PostData' LIMIT 1

To:
Code:
SELECT id,username,email,salt FROM users WHERE email='PostData' OR username='PostData' LIMIT 1

Anytime I find myself worrying about performance, I compare my app to WordPress, and then I know that then I know little things don't matter so much. Unless something changed, WordPress is like 30 queries just to load a basic pageĀ  Big Grin
Reply


Messages In This Thread
RE: Username And Email Login Form Validation Question - by skunkbad - 04-13-2017, 12:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB