public static function getInstance() { if (self::$Instance == false) { self::$Instance = new bazadanych(); } return self::$Instance; }
public function sprzedarz($sprzedane) { $db = bazadanych::getInstance(); foreach ($sprzedane as $p) { $db->usun('ekwipunek', array('nazwa' => $p['nazwa'], 'id_postaci' => $this->wiedzmin->Getparam->getId())); } }
public function getekwpunek() { $this->db = bazadanych::getInstance(); $sql = "select * from ekwipunek"; $query = $this->db->getConnection()->prepare($sql); $query->execute(); $this->ekwipunek = $query->fetchAll(); }
public function getPotwor($name) { $this->db = bazadanych::getInstance(); $sql = "select * from potwor where 'potwor_name' = {$name}"; $query = $this->db->prepare($sql); $query->execute(array($name)); $result = $query->fetchAll(); return $result; }
public function wybierz($id){ $db=bazadanych::getInstance(); $wynik=$db->select('postac',array('id'=>$id)); if($wynik == false){ return false; } return $wynik; }
public function wybranyprzeciwnik($nazwa) { $db = bazadanych::getInstance(); $wynik = $db->select('przeciwnik', array('imie' => $nazwa)); if ($wynik == false) { return false; } return $wynik; }
public function getekwpunek() { $bohater_id = $this->bohater_id; $this->db = bazadanych::getInstance(); $sql = "select * from ekwipunek where bohater_id={$bohater_id}"; $query = $this->db->prepare($sql); $query->execute(array($bohater_id)); $this->ekwipunek = $query->fetchAll(); }
public function sprawdz() { $db = bazadanych::getInstance(); $wynik = $db->select('uzytkownik', array('login' => $this->uzytkownik->getLogin(), 'haslo' => $this->uzytkownik->getHaslo())); if ($wynik == false) { return false; } return $wynik[0]; }
public function zapisz() { //zapisanie do bazy $db = bazadanych::getInstance(); $db->zapisz('uzytkownik', array( 'login'=>$this->uzytkownik->getLogin(), 'haslo'=>$this->uzytkownik->getHaslo() )); }
public function getpunktydorozdania($bohater) { $this->db = bazadanych::getInstance(); $bohater_id = $bohater[0][id]; $sql = "select * from poziom where 'bohater_id' = {$bohater_id}"; $query = $this->db->prepare($sql); $query->execute(array($bohater_id)); $this->result = $query->fetchAll(); $this->obsluga($bohater); if ($this->result[0][punkty] > 0) { $form = "sila:" + $this->form('sila') + "zrecznosc" + $this->form('zrecznosc') + "szybkosc" + $this->form('szybkosc') + "zycie" + $this->form('zycie'); return $form; } }
public function serialized($user_id, $update = false) { $name = $this->name; $serialized = $this->serialized; $this->db = bazadanych::getInstance(); if ($update == false) { $sql = "insert into serializacja ('user_id', 'serialized','name') values (:user_id, :serialized, :name)"; $query = $this->db->getConnection()->prepare($sql); $query->execute(array(":user_id" => $user_id, ":serialized" => $serialized, ":name" => $name)); } else { $sql = "UPDATE serializacja SET serialized=:serialized name=:name WHERE user_id=:user_id AND name=:name"; $query = $query = $this->db->prepare($sql); $query->execute(array($serialized, $name, $user_id)); } }
public function transakcja() { if ($this->getpost('submit') == "kupno") { $zloto = $this->potrzebnezloto(); if ($this->wiedzmin->getgold() > $zloto) { $this->db = $this->db = bazadanych::getInstance(); $this->nieposiadanerzeczy(); $this->kupno(); $this->wiedzmin->setGold($this->wiedzmin->getgold - $zloto); } } elseif ($this->getpost('submit') == "sprzedaz") { $zloto = $this->potrzebnezloto(); $this->db = $this->db = bazadanych::getInstance(); $this->sprzedarz(); $this->wiedzmin->setGold($this->wiedzmin->getgold + $zloto); } }
public function statystykiwyswietl($param) { $db = bazadanych::getInstance(); $wynik = $db->select('postac'); if (isset($wynik)) { for ($i = 0; $i < count($wynik); $i++) { $stat[$wynik[$i]['imie']] = $wynik[$i][$param]; } asort($stat); $pos = ""; foreach ($stat as $key => $val) { $pos .= $key . "=" . $val . ""; } return $pos; } else { return false; } }
public function transakcja($transakcja) { $this->db = $this->db = bazadanych::getInstance(); if ($transakcja == "kupno") { $zloto = $this->potrzebnezloto(); if ($this->wiedzmin->getgold() > $zloto) { $this->nieposiadanerzeczy(); $this->kupno(); $this->wiedzmin->setGold($this->wiedzmin->getgold - $zloto); return "zakupiono przedmioty"; } else { return "Nie masz wystarczajaco pieniendzy"; } } elseif ($transakcja == "sprzedaz") { $zloto = $this->potrzebnezloto(); $this->sprzedarz(); $this->wiedzmin->setGold($this->wiedzmin->getgold + $zloto); return "Sprzedano Przedmioty"; } else { return "Zly rodzaj transakcji"; } }
public function showekwipunek() { $db = bazadanych::getInstance(); $wynik = $db->select('ekwipunek', array('postac_id' => $this->bohater_id)); return $wynik; }
public function zapisz() { $db = bazadanych::getInstance(); $db->zapisz('nowypoziom', array('poziom' => 1, 'punkty' => 0, 'id_postaci' => $this->wiedzmin->Getparam()->getId())); }
public function setGold($gold) { $this->db = bazadanych::getInstance(); $bohater_id = $this->bohater_id; $sql = "UPDATE poziom SET gold=:gold WHERE bohater_id=:bohater_id"; $query = $query = $this->db->prepare($sql); $query->execute(array($gold, $bohater_id)); }
public function setGold($gold) { $db = bazadanych::getInstance(); $db->update('postac', array('zloto' => $gold), array('id' => $this->getId())); $this->gold = $gold; }