function getAll() { $db = DB::GetConn(); $getQuery = "SELECT * FROM `Weapon`;"; $res = $db->query($getQuery); //execute query $returnWeapons = array(); while ($obj = $res->fetchObject()) { array_push($returnWeapons, Weapon::loadWeaponFromObject($obj)); } return $returnWeapons; }
function loadWeapon($ID) { //check ID is not blank and exists and such $db = DB::GetConn(); $id_con = $db->quoteInto("ID = ?", $ID); $getQuery = "SELECT * FROM `Weapon` WHERE {$id_con} limit 1;"; $res = $db->query($getQuery); $obj = $res->fetchObject(); return Weapon::loadWeaponFromObject($obj); }