コード例 #1
0
ファイル: getCR.php プロジェクト: NathanMize/Monster-Database
 function getCR()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $minCR = (string) htmlspecialchars($_POST['getCRmin']);
     $maxCR = (string) htmlspecialchars($_POST['getCRmax']);
     $return = array();
     $return['cr'] = array();
     $return['name'] = array();
     $stmt = $mysqli->prepare("SELECT C.name, C.cr FROM mm_creatures C WHERE C.cr >= ? AND C.cr <= ? ORDER BY C.cr, C.name");
     $stmt->bind_param("dd", $minCR, $maxCR);
     $stmt->execute();
     $stmt->bind_result($rowName, $rowCR);
     while ($stmt->fetch()) {
         if (strlen($rowName) > 0) {
             $return['name'][] = "<a href='MonsterDisplay.html?name=" . $rowName . "'>" . $rowName . "</a>";
             $return['cr'][] = $rowCR;
         }
     }
     $stmt->close();
     return json_encode($return);
 }
コード例 #2
0
 function getSense()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $sense = (string) htmlspecialchars($_POST['sense']);
     $return = array();
     $return['sense'] = $sense;
     $return['range'] = array();
     $return['name'] = array();
     $stmt = $mysqli->prepare("SELECT C.name, CS.distance FROM mm_creatures C\n\t\t\t\t\t\t\t\t\t  INNER JOIN mm_c_senses CS ON C.id = CS.creature_id\n\t\t\t\t\t\t\t\t\t  INNER JOIN mm_senses S ON CS.sense_id = S.id\n\t\t\t\t\t\t\t\t\t  WHERE S.name = ?\n\t\t\t\t\t\t\t\t\t  ORDER BY CS.distance, C.name");
     $stmt->bind_param("s", $sense);
     $stmt->execute();
     $stmt->bind_result($rowName, $rowRange);
     while ($stmt->fetch()) {
         if (strlen($rowName) > 0) {
             $return['name'][] = "<a href='MonsterDisplay.html?name=" . $rowName . "'>" . $rowName . "</a>";
             $return['range'][] = $rowRange;
         }
     }
     $stmt->close();
     return json_encode($return);
 }
コード例 #3
0
 function getAttr()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $attr = (string) htmlspecialchars($_POST['getAttr']);
     $stat = (string) htmlspecialchars($_POST['getStat']);
     $return = array();
     $return['attr'] = $attr;
     $return['value'] = $stat;
     $return['stat'] = array();
     $return['name'] = array();
     $stmt = $mysqli->prepare("SELECT C.name, CA.stat FROM mm_creatures C\n\t\t\t\t\t\t\t\t\t  INNER JOIN mm_c_attr CA ON C.id = CA.creature_id\n\t\t\t\t\t\t\t\t\t  INNER JOIN mm_attributes A ON CA.attribute = A.id\n\t\t\t\t\t\t\t\t\t  WHERE A.name = ? AND CA.stat >= ?\n\t\t\t\t\t\t\t\t\t  ORDER BY CA.stat");
     $stmt->bind_param("sd", $attr, $stat);
     $stmt->execute();
     $stmt->bind_result($rowName, $rowStat);
     while ($stmt->fetch()) {
         if (strlen($rowName) > 0) {
             $return['name'][] = "<a href='MonsterDisplay.html?name=" . $rowName . "'>" . $rowName . "</a>";
             $return['stat'][] = $rowStat;
         }
     }
     $stmt->close();
     return json_encode($return);
 }
コード例 #4
0
 function addCreature()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $name = (string) htmlspecialchars($_POST['creatureName']);
     $hp = (string) htmlspecialchars($_POST['creatureHP']);
     $ac = (string) htmlspecialchars($_POST['creatureAC']);
     $cr = (string) htmlspecialchars($_POST['creatureCR']);
     $type = (string) htmlspecialchars($_POST['creatureType']);
     $return = array();
     $return['name'] = $name;
     $return['hp'] = $hp;
     $return['ac'] = $ac;
     $return['cr'] = $cr;
     $return['type'] = $type;
     if (count($_POST) > 0) {
         $stmt = $mysqli->prepare("INSERT INTO mm_creatures(name, hp, ac, cr, type_id) \n\t\t\t\t\t\t\t\t\t\t\t\t  VALUES (?, ?, ?, ?, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t (SELECT id FROM mm_types WHERE category = ?))\n\t\t\t\t\t\t\t\t\t\t\t\t  ON DUPLICATE KEY UPDATE hp = ?, ac = ?, cr = ?, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype_id = (SELECT id FROM mm_types WHERE category = ?)");
         $stmt->bind_param("sdddsddds", $name, $hp, $ac, $cr, $type, $hp, $ac, $cr, $type);
         $stmt->execute();
         $stmt->close();
     }
     return json_encode($return);
 }
コード例 #5
0
 function delEnviron()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $name = (string) htmlspecialchars($_POST['del_envir']);
     $return = array();
     $return['name'] = $name;
     $stmt = $mysqli->prepare("DELETE FROM mm_environments WHERE name = ?");
     $stmt->bind_param("s", $name);
     $stmt->execute();
     $stmt->close();
     return json_encode($return);
 }
コード例 #6
0
 function delAttr()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $attr_name = (string) htmlspecialchars($_POST['del_attr']);
     $return = array();
     $return['name'] = $attr_name;
     if (count($_POST) > 0) {
         $stmt = $mysqli->prepare("DELETE FROM mm_attributes WHERE name = ? LIMIT 1");
         $stmt->bind_param("s", $attr_name);
         $stmt->execute();
         $stmt->close();
     }
     return json_encode($return);
 }
コード例 #7
0
 function remCSenses()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $creature_name = (string) htmlspecialchars($_POST['rem_senses']);
     $return = array();
     $return['name'] = $creature_name;
     if (count($_POST) > 0) {
         $stmt = $mysqli->prepare("DELETE FROM mm_c_senses WHERE creature_id = \n\t\t\t\t\t\t\t\t\t\t(SELECT id FROM mm_creatures WHERE name= ?)");
         $stmt->bind_param("s", $creature_name);
         $stmt->execute();
         $stmt->close();
     }
     return json_encode($return);
 }
コード例 #8
0
 function addSense()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $nameInput = (string) htmlspecialchars($_POST['senseName']);
     $return = array();
     $return['name'] = $nameInput;
     if (count($_POST) > 0) {
         $stmt = $mysqli->prepare("INSERT INTO mm_senses(name) \n\t\t\t\t\t\t\t\t\t\t\t\t  VALUES (?)");
         $stmt->bind_param("s", $nameInput);
         $stmt->execute();
         $stmt->close();
     }
     return json_encode($return);
 }
コード例 #9
0
 function addCreatureEnviron()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $creature = (string) htmlspecialchars($_POST['ce_creature']);
     $environ = (string) htmlspecialchars($_POST['ce_name']);
     $return = array();
     $return['creature'] = $creature;
     $return['environ'] = $environ;
     if (count($_POST) > 0) {
         $stmt = $mysqli->prepare("INSERT INTO mm_c_environ (creature_id, envir_id)\n\t\t\t\t\t\t\t\t\t\t  VALUES\n\t\t\t\t\t\t\t\t\t\t\t((SELECT id FROM mm_creatures WHERE name= ?),\n\t\t\t\t\t\t\t\t\t\t\t (SELECT id FROM mm_environments WHERE name= ?))");
         $stmt->bind_param("ss", $creature, $environ);
         $stmt->execute();
         $stmt->close();
     }
     return json_encode($return);
 }
コード例 #10
0
 function addSkill()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $nameInput = (string) htmlspecialchars($_POST['skillName']);
     $attrInput = (string) htmlspecialchars($_POST['skillAttr']);
     $return = array();
     $return['attr'] = $attrInput;
     $return['name'] = $nameInput;
     if (count($_POST) > 0) {
         $stmt = $mysqli->prepare("INSERT INTO mm_skills(name, attribute) \n\t\t\t\t\t\t\t\t\t\t\t\t  VALUES (?, (SELECT id FROM mm_attributes WHERE name = ?))\n\t\t\t\t\t\t\t\t\t\t\t\t  ON DUPLICATE KEY UPDATE attribute = (SELECT id FROM mm_attributes WHERE name = ?)");
         $stmt->bind_param("sss", $nameInput, $attrInput, $attrInput);
         $stmt->execute();
         $stmt->close();
     }
     return json_encode($return);
 }
コード例 #11
0
 function addMinion()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $boss = (string) htmlspecialchars($_POST['boss']);
     $minion = (string) htmlspecialchars($_POST['minion']);
     $return = array();
     $return['boss'] = $boss;
     $return['minion'] = $minion;
     if (count($_POST) > 0) {
         $stmt = $mysqli->prepare("INSERT INTO mm_minions(boss_id, minion_id) \n\t\t\t\t\t\t\t\t\t\t\tVALUES ((SELECT id FROM mm_creatures WHERE name = ?), \n\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT id FROM mm_creatures WHERE name = ?))");
         $stmt->bind_param("ss", $boss, $minion);
         $stmt->execute();
         $stmt->close();
     }
     return json_encode($return);
 }
コード例 #12
0
 function addCreatureSense()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $creature = (string) htmlspecialchars($_POST['csen_creature']);
     $sense = (string) htmlspecialchars($_POST['csen_name']);
     $range = (string) htmlspecialchars($_POST['csen_range']);
     $return = array();
     $return['creature'] = $creature;
     $return['sense'] = $sense;
     $return['range'] = $range;
     if (count($_POST) > 0) {
         $stmt = $mysqli->prepare("INSERT INTO mm_c_senses (creature_id, sense_id, distance)\n\t\t\t\t\t\t\t\t\t\t  VALUES\n\t\t\t\t\t\t\t\t\t\t\t((SELECT id FROM mm_creatures WHERE name= ?),\n\t\t\t\t\t\t\t\t\t\t\t (SELECT id FROM mm_senses WHERE name= ?),\n\t\t\t\t\t\t\t\t\t\t\t  ?)\n\t\t\t\t\t\t\t\t\t\t\t  ON DUPLICATE KEY UPDATE distance = ?");
         $stmt->bind_param("ssdd", $creature, $sense, $range, $range);
         $stmt->execute();
         $stmt->close();
     }
     return json_encode($return);
 }
コード例 #13
0
 function addCreatureSkill()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $creature = (string) htmlspecialchars($_POST['cs_creature']);
     $skill = (string) htmlspecialchars($_POST['cs_skill']);
     $bonus = (string) htmlspecialchars($_POST['cs_bonus']);
     $return = array();
     $return['creature'] = $creature;
     $return['skill'] = $skill;
     $return['bonus'] = $bonus;
     if (count($_POST) > 0) {
         $stmt = $mysqli->prepare("INSERT INTO mm_c_skills (creature_id, skill_id, bonus)\n\t\t\t\t\t\t\t\t\t\t  VALUES\n\t\t\t\t\t\t\t\t\t\t\t((SELECT id FROM mm_creatures WHERE name= ?),\n\t\t\t\t\t\t\t\t\t\t\t (SELECT id FROM mm_skills WHERE name= ?),\n\t\t\t\t\t\t\t\t\t\t\t  ?)\n\t\t\t\t\t\t\t\t\t\t\t  ON DUPLICATE KEY UPDATE bonus = ?");
         $stmt->bind_param("ssdd", $creature, $skill, $bonus, $bonus);
         $stmt->execute();
         $stmt->close();
     }
     return json_encode($return);
 }
コード例 #14
0
 function addCreatureAttr()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $creature = (string) htmlspecialchars($_POST['ca_creature']);
     $attr = (string) htmlspecialchars($_POST['ca_attr']);
     $value = (string) htmlspecialchars($_POST['ca_value']);
     $return = array();
     $return['creature'] = $creature;
     $return['attr'] = $attr;
     $return['value'] = $value;
     if (count($_POST) > 0) {
         $stmt = $mysqli->prepare("INSERT INTO mm_c_attr (creature_id, attribute, stat)\n\t\t\t\t\t\t\t\t\t\t  VALUES\n\t\t\t\t\t\t\t\t\t\t\t((SELECT id FROM mm_creatures WHERE name= ?),\n\t\t\t\t\t\t\t\t\t\t\t (SELECT id FROM mm_attributes WHERE name= ?),\n\t\t\t\t\t\t\t\t\t\t\t  ?)\n\t\t\t\t\t\t\t\t\t\t\t  ON DUPLICATE KEY UPDATE stat = ?");
         $stmt->bind_param("ssdd", $creature, $attr, $value, $value);
         $stmt->execute();
         $stmt->close();
     }
     return json_encode($return);
 }
コード例 #15
0
 function getType()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $creatureType = (string) htmlspecialchars($_POST['creatureType']);
     $return = array();
     $return['creatureType'] = $creatureType;
     $return['name'] = array();
     $stmt = $mysqli->prepare("SELECT C.name FROM mm_creatures C\n\t\t\t\t\t\t\t\t\t  INNER JOIN mm_types T ON C.type_id = T.id\n\t\t\t\t\t\t\t\t\t  WHERE T.category = ?");
     $stmt->bind_param("s", $creatureType);
     $stmt->execute();
     $stmt->bind_result($rowName);
     while ($stmt->fetch()) {
         if (strlen($rowName) > 0) {
             $return['name'][] = "<a href='MonsterDisplay.html?name=" . $rowName . "'>" . $rowName . "</a>";
         }
     }
     $stmt->close();
     return json_encode($return);
 }
コード例 #16
0
 function getCR()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $boss = (string) htmlspecialchars($_POST['boss']);
     $return = array();
     $return['boss'] = $boss;
     $return['name'] = array();
     $stmt = $mysqli->prepare("SELECT CM.name FROM mm_creatures CB\n\t\t\t\t\t\t\t\t\t  INNER JOIN mm_minions M ON CB.id = M.boss_id\n\t\t\t\t\t\t\t\t\t  INNER JOIN mm_creatures CM ON M.minion_id = CM.id\n\t\t\t\t\t\t\t\t\t  WHERE CB.name = ?");
     $stmt->bind_param("s", $boss);
     $stmt->execute();
     $stmt->bind_result($rowName);
     while ($stmt->fetch()) {
         if (strlen($rowName) > 0) {
             $return['name'][] = "<a href='MonsterDisplay.html?name=" . $rowName . "'>" . $rowName . "</a>";
         }
     }
     $stmt->close();
     return json_encode($return);
 }
コード例 #17
0
 function getCR()
 {
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         exit;
     }
     $environ = (string) htmlspecialchars($_POST['environ']);
     $return = array();
     $return['environ'] = $environ;
     $return['name'] = array();
     $stmt = $mysqli->prepare("SELECT C.name FROM mm_creatures C\n\t\t\t\t\t\t\t\t\t  INNER JOIN mm_c_environ CE ON C.id = CE.creature_id\n\t\t\t\t\t\t\t\t\t  INNER JOIN mm_environments E ON CE.envir_id = E.id\n\t\t\t\t\t\t\t\t\t  WHERE E.name = ?\n\t\t\t\t\t\t\t\t\t  ORDER BY C.name");
     $stmt->bind_param("s", $environ);
     $stmt->execute();
     $stmt->bind_result($rowName);
     while ($stmt->fetch()) {
         if (strlen($rowName) > 0) {
             $return['name'][] = "<a href='MonsterDisplay.html?name=" . $rowName . "'>" . $rowName . "</a>";
         }
     }
     $stmt->close();
     return json_encode($return);
 }
コード例 #18
0
 function requestLists()
 {
     $return = array();
     $name = (string) htmlspecialchars($_POST['name']);
     $return['name'] = $name;
     $return['attr'] = array();
     $return['attrValue'] = array();
     $return['skills'] = array();
     $return['skillsValue'] = array();
     $return['sense'] = array();
     $return['senseValue'] = array();
     $return['environ'] = array();
     $return['minions'] = array();
     $return['bosses'] = array();
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     $stmt = $mysqli->prepare("SELECT C.hp, C.ac, C.cr, T.category FROM mm_creatures C\n\t\t\t\t\t\t\t\t\t\t  INNER JOIN mm_types T ON C.type_id = T.id\n\t\t\t\t\t\t\t\t\t\t  WHERE C.name = ?");
     $stmt->bind_param("s", $name);
     $stmt->execute();
     $stmt->bind_result($hp, $ac, $cr, $type);
     while ($stmt->fetch()) {
         $return['hp'] = $hp;
         $return['ac'] = $ac;
         $return['cr'] = $cr;
         $return['type'] = $type;
     }
     $stmt->close();
     $stmt = $mysqli->prepare("SELECT A.name, CA.stat FROM mm_creatures C\n\t\t\t\t\t\t\t\t\t\t  INNER JOIN mm_c_attr CA ON C.id = CA.creature_id\n\t\t\t\t\t\t\t\t\t\t  INNER JOIN mm_attributes A ON CA.attribute = A.id\n\t\t\t\t\t\t\t\t\t\t  WHERE C.name = ?\n\t\t\t\t\t\t\t\t\t\t  ORDER BY A.id");
     $stmt->bind_param("s", $name);
     $stmt->execute();
     $stmt->bind_result($attrName, $stat);
     while ($stmt->fetch()) {
         $return['attr'][] = $attrName;
         $return['attrValue'][] = $stat;
     }
     $stmt->close();
     $stmt = $mysqli->prepare("SELECT S.name, CS.bonus FROM mm_creatures C\n\t\t\t\t\t\t\t\t\t\t  INNER JOIN mm_c_skills CS ON C.id = CS.creature_id\n\t\t\t\t\t\t\t\t\t\t  INNER JOIN mm_skills S ON CS.skill_id = S.id\n\t\t\t\t\t\t\t\t\t\t  WHERE C.name = ?");
     $stmt->bind_param("s", $name);
     $stmt->execute();
     $stmt->bind_result($rowName, $rowBonus);
     while ($stmt->fetch()) {
         if (strlen($rowName) > 0) {
             $return['skills'][] = $rowName;
             $return['skillsValue'][] = $rowBonus;
         }
     }
     $stmt->close();
     $stmt = $mysqli->prepare("SELECT S.name, CS.distance FROM mm_creatures C\n\t\t\t\t\t\t\t\t\t\t  INNER JOIN mm_c_senses CS ON C.id = CS.creature_id\n\t\t\t\t\t\t\t\t\t\t  INNER JOIN mm_senses S ON CS.sense_id = S.id\n\t\t\t\t\t\t\t\t\t\t  WHERE C.name = ?");
     $stmt->bind_param("s", $name);
     $stmt->execute();
     $stmt->bind_result($rowName, $rowRange);
     while ($stmt->fetch()) {
         if (strlen($rowName) > 0) {
             $return['sense'][] = $rowName;
             $return['senseValue'][] = $rowRange;
         }
     }
     $stmt->close();
     $stmt = $mysqli->prepare("SELECT E.name FROM mm_creatures C\n\t\t\t\t\t\t\t\t\t\t  INNER JOIN mm_c_environ CE ON C.id = CE.creature_id\n\t\t\t\t\t\t\t\t\t\t  INNER JOIN mm_environments E ON CE.envir_id = E.id\n\t\t\t\t\t\t\t\t\t\t  WHERE C.name = ?");
     $stmt->bind_param("s", $name);
     $stmt->execute();
     $stmt->bind_result($rowName);
     while ($stmt->fetch()) {
         if (strlen($rowName) > 0) {
             $return['environ'][] = $rowName;
         }
     }
     $stmt->close();
     $stmt = $mysqli->prepare("SELECT CM.name FROM mm_creatures CB\n\t\t\t\t\t\t\t\t\t\t  INNER JOIN mm_minions M ON CB.id = M.boss_id\n\t\t\t\t\t\t\t\t\t\t  INNER JOIN mm_creatures CM ON M.minion_id = CM.id\n\t\t\t\t\t\t\t\t\t\t  WHERE CB.name = ?");
     $stmt->bind_param("s", $name);
     $stmt->execute();
     $stmt->bind_result($rowName);
     while ($stmt->fetch()) {
         if (strlen($rowName) > 0) {
             $return['minion'][] = "<a href='MonsterDisplay.html?name=" . $rowName . "'>" . $rowName . "</a>";
         }
     }
     $stmt->close();
     $stmt = $mysqli->prepare("\tSELECT CB.name\n\t\t\t\t\t\t\t\t\t\tFROM mm_creatures CB\n\t\t\t\t\t\t\t\t\t\tINNER JOIN mm_minions M ON CB.id = M.boss_id\n\t\t\t\t\t\t\t\t\t\tWHERE M.minion_id = (SELECT id FROM mm_creatures WHERE name = ?)");
     $stmt->bind_param("s", $name);
     $stmt->execute();
     $stmt->bind_result($rowName);
     while ($stmt->fetch()) {
         if (strlen($rowName) > 0) {
             $return['bosses'][] = "<a href='MonsterDisplay.html?name=" . $rowName . "'>" . $rowName . "</a>";
         }
     }
     $stmt->close();
     return json_encode($return);
 }
コード例 #19
0
 function requestLists()
 {
     $return = array();
     $return['attr'] = array();
     $return['creature'] = array();
     $return['type'] = array();
     $return['skill'] = array();
     $return['sense'] = array();
     $return['environ'] = array();
     require 'Mize_connect.php';
     $mysqli = Mize_server();
     // get attribute list
     $stmt = $mysqli->prepare("SELECT name FROM mm_attributes ORDER BY id");
     $stmt->execute();
     $stmt->bind_result($name);
     while ($stmt->fetch()) {
         $return['attr'][] = $name;
     }
     $stmt->close();
     // get creature list
     $stmt = $mysqli->prepare("SELECT name FROM mm_creatures");
     $stmt->execute();
     $stmt->bind_result($name);
     while ($stmt->fetch()) {
         $return['creature'][] = $name;
     }
     $stmt->close();
     // get type list
     $stmt = $mysqli->prepare("SELECT category FROM mm_types");
     $stmt->execute();
     $stmt->bind_result($name);
     while ($stmt->fetch()) {
         $return['type'][] = $name;
     }
     $stmt->close();
     // get skill list
     $stmt = $mysqli->prepare("SELECT name FROM mm_skills");
     $stmt->execute();
     $stmt->bind_result($name);
     while ($stmt->fetch()) {
         $return['skill'][] = $name;
     }
     $stmt->close();
     // get sense list
     $stmt = $mysqli->prepare("SELECT name FROM mm_senses");
     $stmt->execute();
     $stmt->bind_result($name);
     while ($stmt->fetch()) {
         $return['sense'][] = $name;
     }
     $stmt->close();
     // get environ list
     $stmt = $mysqli->prepare("SELECT name FROM mm_environments");
     $stmt->execute();
     $stmt->bind_result($name);
     while ($stmt->fetch()) {
         $return['environ'][] = $name;
     }
     $stmt->close();
     return json_encode($return);
 }