ShowSQLQuery)
{
if(isset($_SERVER['REMOTE_ADDR'])) echo('
'.$Query.'
');
else echo($Query."\n");
}
$Result = parent::query($Query);
if(($this->error != '') and ($this->ShowSQLError))
{
if(isset($_SERVER['REMOTE_ADDR'])) echo('SQL Error: '.$this->error.'
'.$Query.'
');
echo('SQL Error: '.$this->error.' '.$Query."\n");
}
return($Result);
}
function select($Table, $What = '*', $Condition = 1)
{
return($this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition));
}
function delete($Table, $Condition)
{
$this->query('DELETE FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition);
}
function insert($Table, $Data)
{
$Name = '';
$Values = '';
foreach($Data as $Key => $Value)
{
$Name .= ',`'.$Key.'`';
if(!in_array($Value, $this->Functions)) $Value = '"'.$this->real_escape_string($Value).'"';
$Values .= ','.$Value;
}
$Name = substr($Name, 1);
$Values = substr($Values, 1);
$this->query('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')');
}
function update($Table, $Condition, $Data)
{
$Values = '';
foreach($Data as $Key => $Value)
{
if(!in_array($Value, $this->Functions)) $Value = '"'.$this->real_escape_string($Value).'"';
$Values .= ', `'.$Key.'`='.$Value;
}
$Values = substr($Values, 2);
$this->query('UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')');
}
function replace($Table, $Data)
{
$Name = '';
$Values = '';
foreach($Data as $Key => $Value)
{
if(!in_array($Value, $this->Functions)) $Value = '"'.$this->real_escape_string($Value).'"';
$Name .= ',`'.$Key.'`';
$Values .= ','.$Value;
}
$Name = substr($Name, 1);
$Values = substr($Values, 1);
//echo('REPLACE INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES ('.$Values.')
');
$this->query('REPLACE INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')');
//echo($this->error().'
');
}
function charset($Charset)
{
$this->query('SET NAMES "'.$Charset.'"');
}
function TimeToMysqlDateTime($Time)
{
return(date('Y-m-d H:i:s', $Time));
}
function MysqlDateTimeToTime($Time)
{
$Parts = explode(' ', $Time);
$DateParts = explode('-', $Parts[0]);
$TimeParts = explode(':', $Parts[1]);
$Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]);
return($Result);
}
function MysqlDateToTime($Time)
{
return(MysqlDateTimeToTime($Time.' 0:0:0'));
}
}
?>