summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2012-02-21 17:32:16 +0100
committerAleksander Machniak <machniak@kolabsys.com>2012-02-21 17:32:16 +0100
commitcb9f5ab425055e4ae5740d9674c31348c7289050 (patch)
tree696b42a5f8302456424f43de26854df12ff3bf9d
parent65fb0ab82b0c83dbcf30a767d5b574cfe90e8784 (diff)
downloadwebadmin-cb9f5ab425055e4ae5740d9674c31348c7289050.tar.gz
Added simple SQL error handling/logging
-rw-r--r--lib/SQL.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/SQL.php b/lib/SQL.php
index 6f4ac6b..fb27c30 100644
--- a/lib/SQL.php
+++ b/lib/SQL.php
@@ -56,11 +56,19 @@ class SQL
$result = mysql_query($query);
+ if (!$result) {
+ write_log('errors', 'SQL Error: ' . mysql_error($this->conn));
+ }
+
return $result;
}
public function fetch_assoc($result)
{
+ if (!$result) {
+ return array();
+ }
+
return mysql_fetch_assoc($result);
}