errno.") ".$dbconnect->error; } function dbquery($query) { global $debug, $headerSent, $dbconnect; if($debug && $headerSent) echo "\n"; $result = NULL; try { $result = $dbconnect->query($query); } catch (mysqli_sql_exception $e) { if(function_exists('accessDenied')) { accessDenied(_FATALERROR . (isADMIN ? "Query: " . $query . "
Error: " . dberror() : "")); } else { // this is very rare case. Uncomment this if you really lost what is doing. This is before pagesetup.php, so Admin is not set // echo "Query: " . $query . "
Error: " . dberror() . "
" ; die(" A fatal MySQL error was encountered.
Check tableprefix. "); } } return $result; } function dbnumrows($query) { global $debug, $dbconnect; if ($query === false && $debug) { echo "\n"; } return $query === false ? 0 : $query->num_rows; } function dbfetcharray($query) { global $debug, $dbconnect; if ($query === false && $debug) { echo "\n"; } return $query === false ? null : $query->fetch_array(); } function dbassoc($query) { global $debug, $dbconnect; if ($query === false && $debug) { echo "\n"; } return $query === false ? null : $query->fetch_assoc(); } function dbinsertid($tablename = 0) { global $dbconnect; return $dbconnect->insert_id; } function dbrow($query) { global $debug, $dbconnect; if ($query === false && $debug) { if($dbconnect->error) echo "\n"; } return $query === false ? null : $query->fetch_row(); } function dbclose() { global $dbconnect; if($dbconnect instanceof mysqli) $dbconnect->close(); } // Used to escape text being put into the database. function escapestring($str) { global $dbconnect; if (!is_array($str)) return $dbconnect->real_escape_string($str); return array_map('escapestring', $str); } // End DB functions } ?>