Hi.
In the pdo reference at http://it.php.net/manual/it/function.pdostatement-rowcount.php to find the number of rows affected by a SELECT statement you have to
use a query with a COUNT .

class LoginModel extends UserModel{
	public function __construct($db){
		parent::__construct($db);
    } 
	public function isUser($name,$password){
		$sql= "SELECT COUNT(user_ID) FROM users WHERE user_name=:name 
		&& user_password=MD5(:password) && user_confirm='1' LIMIT 1";
		$sth= $this->db->prepare($sql);
		$excute= array(':name'=>$name,':password'=>$password);
		$sth->execute($excute);
		return (bool)$sth->fetchColumn();
	}
}

Is it the best way ? :o

Is there other way to get that ?

Bye.

    Is it the best way ?

    Yes, unless you already have a result set and can afford to find out the count after you have cycled through it.

    Is there other way to get that ?

    Do a select, then cycle through the result set and count it yourself.

      Write a Reply...