Welcome Guest, Not a member yet? Register   Sign In
Easy way to check existence of a user in DB ? ( Newbie )
#7

[eluser]Dam1an[/eluser]
[quote author="tekhneek" date="1242047286"]I could be wrong, but wouldn't this achieve the same thing with less code?
Code:
$query = $this->db->get_where('users', array('username' => $username, 'password' => $password));
if ($query->num_rows() === 1) {
   return $query;
} else {
   return false;
}
[/quote]

It would acheive the same with less code, but sometimes its better to be a bit more verbose and a little more clear

I could probably do it all in 1 line of code if I wanted, but if it makes it complicated and difficult to understand, whats the point?
(I know you're example isn't complicated per se, but I'm just making the point)


Messages In This Thread
Easy way to check existence of a user in DB ? ( Newbie ) - by El Forum - 05-11-2009, 02:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB