From 5f0a3741d0a549849b503eca7b6d7b87d9903069 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 13 Dec 2011 14:49:11 +0400 Subject: add Public_Handler misc code cleanup --- include/db.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/db.php') diff --git a/include/db.php b/include/db.php index 7a858ca70..1401c089b 100644 --- a/include/db.php +++ b/include/db.php @@ -61,7 +61,7 @@ function db_query($link, $query, $die_on_error = true) { if (!$result) { $query = htmlspecialchars($query); // just in case if ($die_on_error) { - die("Query $query failed [$result]: " . pg_last_error($link)); + die("Query $query failed [$result]: " . ($link ? pg_last_error($link) : "No connection")); } } return $result; @@ -70,7 +70,7 @@ function db_query($link, $query, $die_on_error = true) { if (!$result) { $query = htmlspecialchars($query); if ($die_on_error) { - die("Query $query failed: " . mysql_error($link)); + die("Query $query failed: " . ($link ? mysql_error($link) : "No connection")); } } return $result; -- cgit v1.2.3