Usage of BD.php inside a class

From: Date: Fri, 13 Apr 2001 19:43:01 +0000
Subject: Usage of BD.php inside a class
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-44@lists.php.net to get a copy of this message
At 16:16 13/04/01 +0200, Markus Fischer wrote:
Hi Luc, I'm looking for the pear equivalent of mysql_num_rows($result)
        Just use $result->numRows(); .
Thanks a lot for your quick answer Marcus.. but I discovered another problem The following is part of a class.. and php complains
Fatal error: Call to a member function on a non-object in backend.php on line 139
//================================== function login ($username, $password) {
        if (!$username || !$password) {
                        return $this->error[14];
        }
        else {
                        if (!eregi("^[[:alnum:]_-]+$", $username)) {
                                return $this->error[3];
                        }
                        if (!eregi("^[[:alnum:]_-]+$", $password)) {
                                return $this->error[7];
                        }
                        $db = DB::connect( "mysql://$dbuser:$dbpass@$dbhost/$dbname" );
                        $sql = "select id from login where username = '$username' and password = '$password'";
THIS IS LINE 139 $query = $this->db->query($sql); $result =$this->db->numRows($query);
                        $this->db->disconnect();
[.....] //================================== Where did I screw up ? Luc

« previous php.pear.general (#44) next »