<?php // add a minion relationship between two creatures class ajaxRequest { 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->addMinion();
<?php // add a type to the database class ajaxRequest { function addType() { 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['typeName']); $return = array(); $return['name'] = $nameInput; if (count($_POST) > 0) { $stmt = $mysqli->prepare("INSERT INTO mm_types(category) \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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->addType();
<?php // remove all creature-sense relationships for a given creature class ajaxRequest { 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->remCSenses();
// add a relationship between a creature and a skill with a bonus value, // update bonus value if relationship already exists class ajaxRequest { 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->addCreatureSkill();
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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->requestLists();
<?php //Add a new relationship between creature and attribute with a given value class ajaxRequest { 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->addCreatureAttr();
<?php //remove all environment-creature relationships for a given creature class ajaxRequest { function remCEnvirs() { 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_envirs']); $return = array(); $return['name'] = $creature_name; if (count($_POST) > 0) { $stmt = $mysqli->prepare("DELETE FROM mm_c_environ 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->remCEnvirs();
<?php // remove a sense from the database class ajaxRequest { function delSense() { 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_sense']); $return = array(); $return['name'] = $name; $stmt = $mysqli->prepare("DELETE FROM mm_senses WHERE name = ?"); $stmt->bind_param("s", $name); $stmt->execute(); $stmt->close(); return json_encode($return); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->delSense();
// add a relationship between a sense and a creature, with a range // update range if relationship already exists. class ajaxRequest { 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->addCreatureSense();
<?php // add an environment to the database class ajaxRequest { function addEnviron() { 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['environName']); $return = array(); $return['name'] = $nameInput; if (count($_POST) > 0) { $stmt = $mysqli->prepare("INSERT INTO mm_environments(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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->addEnviron();
class ajaxRequest { 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->getSense();
<?php //Add a new attribute to the database class ajaxRequest { function addAttribute() { 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['attrName']); $return = array(); $return['name'] = $nameInput; if (count($_POST) > 0) { $stmt = $mysqli->prepare("INSERT INTO mm_attributes(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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->addAttribute();
<?php // add a skill and its associated attribute to the database class ajaxRequest { 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->addSkill();
<?php // add a sense to the database class ajaxRequest { 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->addSense();
<?php // remove all attribute-creature relationships for a given creature class ajaxRequest { function remCAttrs() { 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_attrs']); $return = array(); $return['name'] = $creature_name; if (count($_POST) > 0) { $stmt = $mysqli->prepare("DELETE FROM mm_c_attr 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->remCAttrs();
<?php // remove a type from the table class ajaxRequest { function delType() { 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_type']); $return = array(); $return['name'] = $name; $stmt = $mysqli->prepare("DELETE FROM mm_types WHERE category = ?"); $stmt->bind_param("s", $name); $stmt->execute(); $stmt->close(); return json_encode($return); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->delType();
<?php // add a relationship between a creature and an environment class ajaxRequest { 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->addCreatureEnviron();
<?php // remove a skill from the database class ajaxRequest { function delSkill() { 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_skill']); $return = array(); $return['name'] = $name; $stmt = $mysqli->prepare("DELETE FROM mm_skills WHERE name = ?"); $stmt->bind_param("s", $name); $stmt->execute(); $stmt->close(); return json_encode($return); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->delSkill();
<?php // remove a creature from the database class ajaxRequest { function delCreature() { 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['del_creature']); $return = array(); $return['name'] = $creature_name; if (count($_POST) > 0) { $stmt = $mysqli->prepare("DELETE FROM mm_creatures WHERE name = ? LIMIT 1"); $stmt->bind_param("s", $creature_name); $stmt->execute(); $stmt->close(); } return json_encode($return); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->delCreature();
class ajaxRequest { 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->getCR();
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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->getAttr();
<?php // remove an attribute from the table class ajaxRequest { 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->delAttr();
<?php // remove all minion relationships for a given creature class ajaxRequest { function remCMinions() { 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_minions']); $return = array(); $return['name'] = $creature_name; if (count($_POST) > 0) { $stmt = $mysqli->prepare("DELETE FROM mm_minions WHERE boss_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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->remCMinions();
<?php // remove an environment from the database class ajaxRequest { 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->delEnviron();
<?php class ajaxRequest { 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); } } $ajaxRequest = new ajaxRequest(); echo $ajaxRequest->getType();