Ejemplo n.º 1
0
 function query($s, $ignore_error = 0)
 {
     global $config;
     if ($this->debug_sql) {
         print "<br /><pre>{$s}</pre>";
     }
     if (defined('AM_SQL_PROFILE')) {
         tmUsage('before_query', false, true);
     }
     if ($res = mysql_query($s, $this->conn)) {
         if (defined('AM_SQL_PROFILE')) {
             tmUsage("QUERY:\n<br \\>{$s}\n<br \\>", false, true);
         }
         return $res;
     } else {
         if ($ignore_error) {
             //                print "<font color=red>MYSQL ERROR:<br />" . mysql_error($this->conn) .
             //                "<br />in query:<br />$s</font>";
         } else {
             $t =& new_smarty();
             $t->assign('is_html', 0);
             $t->assign('error', "MYSQL Error happened, script stopped. Website admin\n                can find more details about the problem at CP -> Error Log");
             $t->assign('admin_email', $config['admin_email']);
             $t->display("fatal_error.html");
             $this->log_error("MYSQL ERROR:<br />" . mysql_error($this->conn) . "<br />in query:<br />" . $s, 1, 1);
             exit;
         }
     }
 }
 function query($s, $ignore_error = 0)
 {
     if ($this->debug_sql) {
         print "<br /><pre>{$s}</pre>";
     }
     if (defined('AM_SQL_PROFILE')) {
         tmUsage('before_query', false, true);
     }
     if ($res = mysql_query($s, $this->conn)) {
         if (defined('AM_SQL_PROFILE')) {
             tmUsage("QUERY:\n<br \\>{$s}\n<br \\>", false, true);
         }
         return $res;
     } else {
         if ($ignore_error) {
             print "<font color=red>MYSQL ERROR:<br />" . mysql_error($this->conn) . "<br />in query:<br />{$s}</font>";
         } else {
             fatal_error("MYSQL ERROR:<br />" . mysql_error($this->conn) . "<br />in query:<br />" . $s, 1, 1);
         }
     }
 }