diff --git a/include.mysql.php b/include.mysql.php index 962b98f..b0d4f8a 100644 --- a/include.mysql.php +++ b/include.mysql.php @@ -90,12 +90,24 @@ class CachedPDO extends PDO } $statement->execute(); - $result = $statement->fetchAll(PDO::FETCH_ASSOC); - - mc_set($cache_hash, $result, $expiry); - - $return_object->source = "database"; - $return_object->data = $result; + if($result = $statement->fetchAll(PDO::FETCH_ASSOC)) + { + if(count($result) > 0) + { + mc_set($cache_hash, $result, $expiry); + + $return_object->source = "database"; + $return_object->data = $result; + } + else + { + return false; + } + } + else + { + return null; + } } return $return_object;