'.$Query.'');
$this->LastQuery = $Query;
$DbResult = parent::query($Query);
if(($this->error != '') and ($Config['Web']['ShowSQLError'] == true))
{
echo('Database error: '.$this->error.'
');
echo('Query: '.$Query.'
');
echo('
'); print_r(debug_backtrace()); echo(''); } return($DbResult); } function select($Parameters) // Database, Table, Columns, Condition, Order { $Query = 'SELECT '; if(array_key_exists('Columns', $Parameters)) $Query .= $Parameters['Columns']; else $Query .= '*'; $Query .= ' FROM '; if(array_key_exists('Database', $Parameters) and ($Parameters['Database'] != '')) $Query .= '`'.$Parameters['Database'].'`.'; $Query .= '`'.$this->Prefix.$Parameters['Table'].'`'; if(array_key_exists('Condition', $Parameters)) $Query .= ' WHERE '.$Parameters['Condition']; return($this->query($Query)); } function delete($Parameters) { $Query = 'DELETE FROM '; if(array_key_exists('Database', $Parameters) and ($Parameters['Database'] != '')) $Query .= '`'.$Parameters['Database'].'`.'; $Query .= '`'.$this->Prefix.$Parameters['Table'].'`'; if(array_key_exists('Condition', $Parameters)) $Query .= ' WHERE '.$Parameters['Condition']; $this->query($Query); } function insert($Parameters, $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); $Query = 'INSERT INTO '; if(array_key_exists('Database', $Parameters) and ($Parameters['Database'] != '')) $Query .= '`'.$Parameters['Database'].'`.'; $Query .= '`'.$this->Prefix.$Parameters['Table'].'`'; $Query .= ' ('.$Name.') VALUES ('.$Values.')'; $this->query($Query); } function update($Parameters, $Data) { $Values = ''; foreach($Data as $Key => $Value) { $Value = strtr($Value, '"', '\"'); if($Value != 'NOW()') $Value = "'".$Value."'"; $Values .= ", `".$Key."`=".$Value; } $Values = substr($Values, 2); $Query = 'UPDATE '; if(array_key_exists('Database', $Parameters) and ($Parameters['Database'] != '')) $Query .= '`'.$Parameters['Database'].'`.'; $Query .= '`'.$this->Prefix.$Parameters['Table'].'`'; $Query .= ' SET '.$Values; if(array_key_exists('Condition', $Parameters)) $Query .= ' WHERE '.$Parameters['Condition']; $this->query($Query); } function replace($Parameters, $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.')