LastQuery = $Query;
return(parent::query($Query));
}
function select($Table, $What = '*', $Condition = 1)
{
$this->LastQuery = "SELECT ".$What." FROM `".$this->Prefix.$Table."` WHERE ".$Condition;
return($this->query($this->LastQuery));
}
function delete($Table, $Condition)
{
$this->LastQuery = "DELETE FROM `".$this->Prefix.$Table."` WHERE ".$Condition;
$this->query($this->LastQuery);
}
function insert($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);
$this->LastQuery = 'INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')';
$this->query($this->LastQuery);
}
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->LastQuery = 'UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')';
$this->query($this->LastQuery);
}
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->LastQuery = 'REPLACE INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')';
$this->query($this->LastQuery);
//echo($this->error().'
');
}
function charset($Charset)
{
$this->LastQuery = "SET NAMES '".$Charset."'";
$this->query($this->LastQuery);
}
}
?>