note 31768 rejected from function.mysql-num-rows by didou

From: Date: Tue, 19 Aug 2003 12:26:33 +0000
Subject: note 31768 rejected from function.mysql-num-rows by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-54657@lists.php.net to get a copy of this message
Note Submitter: sdlordstorm@hotmail.com ---- It seems that mysql_num_rows actually returns NULL (at least that's what gettype() shows me) if there are no rows. I've seen countless instances where in a MySQL class or function someone has gone through (what seems to me) reduntant statements to return false if there are no rows. I.E. // Class function function rows() { $rows = mysql_num_rows($this->querid); if ($rows == 0) { return false; } else { return $rows; } When they could simply write: // Class function function rows() { return mysql_num_rows($this->querid); } Of course, I may be wrong...

« previous php.notes (#54657) next »