| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- require_once("DataBase/database.php");
- class Priceset
- {
- function __construct()
- {
- $this->db = new Database();
- }
- function create($priceset_id, $value)
- {
- $query = "INSERT INTO ".$this->db->priceset_table." VALUES('".$priceset_id."'";
- for($i = 0; $i < count($value); $i++)
- $query .= ", '".str_replace("'", "\'", $value[$i])."'";
- $query .= ")";
- $this->db->query($query);
- }
- function update($priceset_id, $value)
- {
- $query = "UPDATE ".$this->db->priceset_table." SET ";
- $query .= "name='".$value[0]."', ";
- $query .= "netto='".$value[1]."' ";
- $query .= "WHERE priceset_id='".$priceset_id."'";
- $this->db->query($query);
- }
- function delete($priceset_id)
- {
- $query = "DELETE FROM ".$this->db->priceset_table." WHERE priceset_id='$priceset_id'";
- $this->db->query($query);
- }
- function get($priceset_id = "", $row_names = array(), $search = "")
- {
- if($priceset_id == "")
- {
- if(count($row_names) == 0)
- $query = "SELECT * FROM ".$this->db->priceset_table;
- else
- {
- $query = "SELECT ".$row_names[0];
- for($i = 1; $i < count($row_names); $i++)
- $query .= ", ".$row_names[$i];
- $query .= " FROM ".$this->db->priceset_table;
- }
- if($search != "")
- $query .= " WHERE ".$search;
- $query .= " ORDER BY priceset_id ASC";
- return $this->db->fetchRows($this->db->query($query));
- }
- else
- {
- $query = "SELECT * FROM ".$this->db->priceset_table." WHERE priceset_id='".$priceset_id."'";
- $query .= " ORDER BY priceset_id ASC";
- return $this->db->fetchRows($this->db->query($query));
- }
- }
- }
- ?>
|