|
|
@ -1253,6 +1253,14 @@ function db_connect ($ignore_errors = false) {
|
|
|
|
global $DEBUG_TEXT;
|
|
|
|
global $DEBUG_TEXT;
|
|
|
|
if ($ignore_errors != 0) $DEBUG_TEXT = '';
|
|
|
|
if ($ignore_errors != 0) $DEBUG_TEXT = '';
|
|
|
|
$error_text = '';
|
|
|
|
$error_text = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static $link;
|
|
|
|
|
|
|
|
if (isset($link) && $link) {
|
|
|
|
|
|
|
|
if ($ignore_errors) {
|
|
|
|
|
|
|
|
return array($link, $error_text);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return $link;
|
|
|
|
|
|
|
|
}
|
|
|
|
$link = 0;
|
|
|
|
$link = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if ($CONF['database_type'] == "mysql") {
|
|
|
|
if ($CONF['database_type'] == "mysql") {
|
|
|
@ -1421,13 +1429,10 @@ function db_query ($query, $ignore_errors = 0) {
|
|
|
|
global $DEBUG_TEXT;
|
|
|
|
global $DEBUG_TEXT;
|
|
|
|
$result = "";
|
|
|
|
$result = "";
|
|
|
|
$number_rows = "";
|
|
|
|
$number_rows = "";
|
|
|
|
static $link;
|
|
|
|
$link = db_connect ();
|
|
|
|
$error_text = "";
|
|
|
|
$error_text = "";
|
|
|
|
if ($ignore_errors) $DEBUG_TEXT = "";
|
|
|
|
if ($ignore_errors) $DEBUG_TEXT = "";
|
|
|
|
|
|
|
|
|
|
|
|
# mysql and pgsql $link are resources, mysqli $link is an object
|
|
|
|
|
|
|
|
if (! (is_resource($link) || is_object($link) ) ) $link = db_connect ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($CONF['database_type'] == "mysql") $result = @mysql_query ($query, $link)
|
|
|
|
if ($CONF['database_type'] == "mysql") $result = @mysql_query ($query, $link)
|
|
|
|
or $error_text = "Invalid query: " . mysql_error($link);
|
|
|
|
or $error_text = "Invalid query: " . mysql_error($link);
|
|
|
|
if ($CONF['database_type'] == "mysqli") $result = @mysqli_query ($link, $query)
|
|
|
|
if ($CONF['database_type'] == "mysqli") $result = @mysqli_query ($link, $query)
|
|
|
|