Есть код моя задача написать функцию что бы этот код работал
$all_products = $p->findAll();
$first = $all_products[0];
$first->name = "New name";
$first->save();
Вот эта функция
public function findAll() {
$query = "SELECT * FROM s_products";
$this->result = mysql_query($query, $this->connect);
$rez = array();
while ($row = mysql_fetch_object($this->result)) {
$rez[] = $row;
}
return $rez;
}
public function save() {
$query = "INSERT INTO `s_products` (`name`, `annotation`, `image`) VALUES ('$this->name', '$this->description', '$this->image')";
$this->result = mysql_query($query, $this->connect);
if ($this->result) {
$this->id = mysql_insert_id();
}
}
У меня возникла ошибка в строке вызова ф-ции $first->save();
Помогите исправит ошибку
Свежие комментарии