Forum Moderators: open
$sql = "SELECT COUNT(*) as NUMBER FROM users WHERE user = '" . $user ."' AND pass = '" . $pass . "'";
$res = mysql_query($sql);
$num = mysql_result($res,0,"NUMBER");if ($num > 0)
return true;
return false;
or this:
$sql = "SELECT user FROM users WHERE user = '" . $user ."' AND pass = '" . $pass . "'";
$res = mysql_query($sql);
$num = mysql_num_rows($res);if ($num > 0)
return true;
return false;
I have done a little reading and Have come across that when using the "WHERE" clause using COUNT it can reduce the speed. Is this a significant speed decrease or is it nominal? Also for future ease of changing database venders, would those queries need to be modified to work with PostgreSQL? (in the future I would like to make a database class and allow multiple database types so instead of mysql_query it would be a function called "query" or "fetch" you get the picture.)
Thank You for any information.
Best Regards,
Brandon
test it outYes...