подскажите меня просто терзают сомнения по поводу этого кода я изменил как мне надо но есть непонятки по последней строке
<?php
@link http://apdate.ru
@author
require_once('apdate.php');
$filter = include('unp.php');
class Settings extends apdate
{
private $vars = array();
function __construct()
{
parent::__construct();
$this->db->query('SELECT name, value FROM __settings WHERE unp=$filter['param']');
foreach($this->db->results() as $result)
if(!($this->vars[$result->name] = @unserialize($result->value)))
$this->vars[$result->name] = $result->value;
}
public function __get($name)
{
if($res = parent::__get($name))
return $res;
if(isset($this->vars[$name]))
return $this->vars[$name];
else
return null;
}
public function __set($name, $value)
{
$this->vars[$name] = $value;
if(is_array($value))
$value = serialize($value);
else
$value = (string) $value;
$this->db->query('SELECT count(*) as count FROM __settings WHERE unp=$filter['param']' and name=?', $name);
if($this->db->result('count')>0)
$this->db->query('UPDATE __settings SET value=? WHERE unp=$filter['param']' name=?', $value, $name);
else
$this->db->query('INSERT INTO __settings SET value=?, name=?', $value, $name WHERE unp=$filter['param']');
}
}
это будет правильным или нет?
$this->db->query('INSERT INTO __settings SET value=?, name=?', $value, $name WHERE unp=$filter['param']');