HOME


Mini Shell 1.0
DIR: /home/islapiiu/sites/araliyagardens/class/
Upload File :
Current File : /home/islapiiu/sites/araliyagardens/class/RoomFeatures.php
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Room Features
 *
 * @author Suharshana DsW
 */
class RoomFeatures {

    public $id;
    public $title;
    public $icon;
    public $queue;

    public function __construct($id) {
        if ($id) {

            $query = "SELECT `id`,`title`,`icon`,`queue` FROM `room_features` WHERE `id`=" . $id;

            $db = new Database();

            $result = mysql_fetch_array($db->readQuery($query));

            $this->id = $result['id'];
            $this->title = $result['title'];
            $this->icon = $result['icon'];
            $this->queue = $result['queue'];

            return $this;
        }
    }

    public function all() {

        $query = "SELECT * FROM `room_features` ORDER BY queue ASC";
        $db = new Database();
        $result = $db->readQuery($query);
        $array_res = array();

        while ($row = mysql_fetch_array($result)) {
            array_push($array_res, $row);
        }

        return $array_res;
    }

    public function arrange($key, $img) {
        $query = "UPDATE `room_features` SET `queue` = '" . $key . "'  WHERE id = '" . $img . "'";
        $db = new Database();
        $result = $db->readQuery($query);
        return $result;
    }

}