MYSQL Testing [ NumRows ] bug on zero rows returned

From: Date: Tue, 12 Dec 2000 17:13:32 +0000
Subject: MYSQL Testing [ NumRows ] bug on zero rows returned
Groups: php.pear 
Request: Send a blank email to php-pear+get-666@lists.php.net to get a copy of this message
Hello !! I've found a problem with the recently implemented numRows for MySql. It returns a DB_error object when no rows are returned in a SELECT statement (zero rows), a perfectly valid case. I came up with a quick fix by changing the error checking condition using the mysql_errno function instead function numRows($result) { $rows = mysql_num_rows($result); // if(!rows) returns an error on zero rows // instead I use if (mysql_errno($this->connection)) { return $this->raiseError($this->errorCode( mysql_errno($this->connection))); } return $rows; } Please let me know if anyones sees a proble with this fix. Bye

« previous php.pear (#666) next »