summaryrefslogtreecommitdiffstats
path: root/lib/class/dba.class.php
diff options
context:
space:
mode:
authorPaul Arthur <paul.arthur@flowerysong.com>2012-04-15 23:28:43 -0400
committerPaul Arthur <paul.arthur@flowerysong.com>2012-04-15 23:32:03 -0400
commit8a93c849e2157b89a8a2ce064e02304e03d38415 (patch)
tree6d8064de55c2fd86ab662d63dd5c24263a7164cd /lib/class/dba.class.php
parentb64649e720055496fb40d7e6b9dbe4d8246e230c (diff)
downloadampache-8a93c849e2157b89a8a2ce064e02304e03d38415.tar.gz
ampache-8a93c849e2157b89a8a2ce064e02304e03d38415.tar.bz2
ampache-8a93c849e2157b89a8a2ce064e02304e03d38415.zip
FS#226 - does not catch MySQL errors before passing to num_rows()
Clean up Dba::num_rows (based on a patch by Natureshadow) We could check before every call instead, but screw that.
Diffstat (limited to 'lib/class/dba.class.php')
-rw-r--r--lib/class/dba.class.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/class/dba.class.php b/lib/class/dba.class.php
index 3910fe50..75735819 100644
--- a/lib/class/dba.class.php
+++ b/lib/class/dba.class.php
@@ -184,14 +184,14 @@ class Dba {
* doesn't work for updates or inserts
*/
public static function num_rows($resource) {
-
- $result = mysql_num_rows($resource);
-
- if (!$result) {
- return '0';
+ if ($resource) {
+ $result = mysql_num_rows($resource);
+ if ($result) {
+ return $result;
+ }
}
- return $result;
+ return 0;
} // num_rows
/**