X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=include%2Fdb.php;h=1401c089b0474e2cf4f64ee89ac2e8ebd736a1d7;hb=5f0a3741d0a549849b503eca7b6d7b87d9903069;hp=7a858ca70596549820f19eda763a23b3bc0a94f3;hpb=46da73c255353a3f874d9742d7b2f9c64e7607b5;p=tt-rss.git diff --git a/include/db.php b/include/db.php index 7a858ca7..1401c089 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;