insert standart
git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@82 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
@ -96,11 +96,14 @@ abstract class Model
|
||||
|
||||
function insert($data, $postfix = '')
|
||||
{
|
||||
$sql = '';
|
||||
$keys = array();
|
||||
$values = array();
|
||||
|
||||
foreach ($data as $key => $val) {
|
||||
$sql .= $key.'="'.$this->escape($val).'", ';
|
||||
$keys[] = $key;
|
||||
$values[] = $this->escape($val);
|
||||
}
|
||||
return $this->query('INSERT '.$this->table.' SET '.rtrim($sql, ', ').' '.$postfix);
|
||||
return $this->query('INSERT INTO '.$this->table.' ('.implode(',', $keys).") VALUES('".implode("','", $values)."') ".$postfix);
|
||||
}
|
||||
|
||||
function delete($id)
|
||||
|
Reference in New Issue
Block a user