'.$Query.'');
$Result = parent::query($Query);
if(($this->error != '') and ($Config['Web']['ShowSQLError'] == true))
echo('
SQL Error: '.$this->error.'
'.$Query.'
');
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)
{
$Value = strtr($Value, '"', '\"');
$Name .= ',`'.$Key.'`';
if($Value == 'NOW()') $Values .= ','.$Value;
else if($Value == 'UUID()') $Values .= ','.$Value;
else $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)
{
$Value = strtr($Value, '"', '\"');
if($Value != 'NOW()') $Value = "'".$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)
{
$Value = strtr($Value, '"', '\"');
$Name .= ',`'.$Key.'`';
if($Value == 'NOW()') $Values .= ','.$Value;
else $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.'"');
}
}
?>