日期:2014-05-16 浏览次数:20475 次
<?php
function Query($id="me",$sql='')
{
$this->Execute($id,$sql);
}
function Execute($id="me", $sql='')
{
global $DB;
if($DB->isClose)
{
$this->Open(false);
$DB->isClose = false;
}
if(!empty($sql))
{
$this->SetQuery($sql);
}
//SQL语句安全检查
if($this->safeCheck)
{
CheckSql($this->queryString);
}
$this->result[$id] = mysql_query($this->queryString,$this->linkID);
if($this->result[$id]===false)
{
$this->DisplayError(mysql_error()." <br />Error sql: <font color='red'>".$this->queryString."</font>");
}
}
function DisplayError($msg)
{
$errorTrackFile = dirname(__FILE__).'/../data/mysql_error_trace.inc';
if( file_exists(dirname(__FILE__).'/../data/mysql_error_trace.php') )
{
@unlink(dirname(__FILE__).'/../data/mysql_error_trace.php');
}
$emsg = '';
$emsg .= "<div><h3>Error Warning!</h3>\r\n";
$emsg .= "<div style='line-helght:160%;font-size:14px;color:green'>\r\n";
$emsg .= "<div style='color:blue'><br />Error page: <font color='red'>".$this->GetCurUrl()."</font></div>\r\n";
$emsg .= "<div>Error infos: {$msg}</div>\r\n";
$emsg .= "<br /></div></div>\r\n";
echo $emsg;
}
?>