web: add error-checking in DB interface layer

This commit is contained in:
David Anderson 2014-06-19 15:22:52 -07:00
parent 45f0fe88c2
commit 29f2cf2cb9
1 changed files with 3 additions and 0 deletions

View File

@ -172,6 +172,7 @@ class DbConn {
}
function get_int($query, $field) {
$result = $this->do_query($query);
if (!$result) error_page("database error on query $query");
if (MYSQLI) {
$x = $result->fetch_object("StdClass");
$result->free();
@ -184,6 +185,7 @@ class DbConn {
}
function get_double($query, $field) {
$result = $this->do_query($query);
if (!$result) error_page("database error on query $query");
if (MYSQLI) {
$x = $result->fetch_object("StdClass");
$result->free();
@ -233,6 +235,7 @@ class DbConn {
}
function table_exists($table_name) {
$result = $this->do_query("show tables from DBNAME like '$table_name'");
if (!$result) error_page("database error on query $query");
if (MYSQLI) {
$t = $result->fetch_array();
$result->free();