This is more of a question to deter which option you guys think its better pro/cons.
Which authentication process is better ?
Option 1
$sql = "SELECT * FROM users WHERE username = $user AND password = $password";
if($result){// success }
Option 2
$sql = 'SELECT * FROM USER WHERE username = $user';
///query goes here and returns to $result
if(count($result)==1 && $_POST['passwod'] == $result['password']){
/// success
}
I have always used the second option but wanna know someone else's opinion.
The code might be a bit messy and vulnerable to hackers but its only for demonstration purposes.