return$this->query('UPDATE '.$this->table.' SET '.rtrim($sql,', ').' WHERE '.$this->primary_key.'='.(int)$id);
}
functioninsert($data,$postfix='')
{
$sql='';
foreach($dataas$key=>$val){
$sql.=$key.'="'.$this->escape($val).'", ';
}
return$this->query('INSERT '.$this->table.' SET '.rtrim($sql,', ').' '.$postfix);
}
functiondelete($id)
{
return$this->query('DELETE FROM '.$this->table.' WHERE '.$this->primary_key.'='.(int)$id);
}
functionget($id)
{
return$this->query('SELECT * FROM '.$this->table.' WHERE '.$this->primary_key.'='.(int)$id);
}
functiongetList($limit=false,$sort='ASC')
{
return$this->query('SELECT * FROM '.$this->table.' ORDER BY '.$this->primary_key.' '.($sort=='ASC'?'ASC':'DESC').($limit===false?' LIMIT '.(int)$limit:''));
}
}
classModelResult
{
function__call($name,$args)
{
thrownewMJException('Call undeclared method "'.$name.'" in "'.get_class($this).'" class',-1);