db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); if ($r){ $this->id = $r["id"]; $this->name = $r["name"]; $this->amount = $r["amount"]; $this->description = $r["description"]; } } /** * Gets the path to the set image. The image must be in the * img/rune/ directory, and its name must be the set id, * padded with '0' to 2 digits, and the extension must be '.png'. * * @return Path to the image, or a path to a fixed unknown image if it * doesn't exist. */ public function get_image(){ global $base_dir; global $path; if (file_exists($base_dir . "img/rune/" . str_pad($this->id, 2, '0', STR_PAD_LEFT) . ".png")){ return $path["img"]["rune"] . str_pad($this->id, 2, '0', STR_PAD_LEFT) . ".png"; } else{ return $path["img"]["root"] . "unknown.png"; } } } ?>