| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- require_once($path["entity"] . "Entity.php");
-
- /**
- * Monster.
- *
- * Represents an object from the table 'monster_base'.
- */
- class Monster_Base extends Entity{
- /**
- * Project identifier.
- */
- public $id;
- /**
- * Monster name.
- */
- public $name;
-
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * base monster, populating it and it's items.
- *
- * @param MySQL_connection $db Connection to the database.
- * @param int $id Base monster identifier.
- */
- public function __construct($db, $id){
- parent::__construct($db);
- $s =
- "SELECT " .
- " id, " .
- " name " .
- "FROM monster_base " .
- "WHERE id = $id; ";
- $q = mysqli_query($this->db, $s);
- if (mysqli_num_rows($q) > 0){
- $r = mysqli_fetch_array($q);
- $this->id = $r["id"];
- $this->name = $r["name"];
- }
- }
- }
- ?>
|