$v) { $this->$k = $v; } } } public function getAll() { $sql = "SELECT * FROM tariffs ORDER BY num"; $rez = mysql_query($sql); $result = array(); while($trf = mysql_fetch_assoc($rez)) { $sql = "SELECT COUNT(*) FROM users WHERE id_tarif=$trf[id]"; $trf['users'] = mysql_result(mysql_query($sql),0); $result[] = $trf; } return $result; } public function addEdit() { if($_GET[id]) $sql = "UPDATE tariffs SET num='$_GET[num]', nazv='$_GET[nazv]', max_worker='$_GET[max_worker]', cena='$_GET[cena]', period='$_GET[period]', opis='$_GET[opis]' WHERE id=$_GET[id]"; else $sql = "INSERT INTO tariffs(num, nazv, cena, period, opis, max_worker) VALUES('$_GET[num]', '$_GET[nazv]', '$_GET[cena]', '$_GET[period]', '$_GET[opis]', '$_GET[max_worker]')"; mysql_query($sql); // header("location:tariffs.php"); } public function changeStatus($status, $id) { $sql = "UPDATE tariffs SET status='$status' WHERE id=$id"; mysql_query($sql); } } ?>