$query = "SELECT code, name, (SELECT name FROM event_cats WHERE event_cats.cat_id=events.cat_id) AS cat, shortdesc, longdesc, tags, contacts, prize, validate FROM events WHERE code = '{$eventcode}'"; $result = $db->query($query); $array = $db->getJSONArray($result); $event = Event::select($db, $eventcode); if (!$event) { die("Funny how curious you are!!..."); } $eventname = $event->getName(); $shortdesc = $event->getShort_desc(); $longdesc = $event->getLong_desc(); $tags = $event->getTags(); $contacts = $event->getContacts(); $prize = $event->getPrize(); $prtpnt = $event->getPrtpnt(); $timings = $event->getTimings(); $cat = EventCategory::select($db, $event->getCat_id()); $category = $cat->getName(); $locid = $event->getLocation_id(); $loc = Location::select($db, $locid); $location = isset($loc) ? $loc->getName() : "Not Set"; $m = explode("||@||", $prtpnt); $max = $min = "Not Set"; if (sizeof($m) == 2) { $max = $m[1]; $min = $m[0]; } $sections = explode("||sec||", $longdesc); foreach ($sections as $section) { $det = explode("||ttl||", $section); if (sizeof($det) == 1) { $details['Introduction'] = $det[0];
require '../classes/EventCategory.php'; require '../classes/Location.php'; $db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE); $out = []; if (isset($_GET['code'])) { $code = $_GET['code']; if (isset($_GET['type']) && $_GET['type'] == 'short') { $e = Event::selectShort($db, $code, FALSE); if ($e != NULL) { $out = $e; } } else { $e = Event::select($db, $code, FALSE); //print_r($e); if ($e != NULL) { $cat = EventCategory::select($db, $e[Event::EVENT_CAT_ID]); $e["cat_name"] = $category = $cat->getName(); $locid = $e[Event::EVENT_LOCATIONID]; $loc = Location::select($db, $locid); $location = isset($loc) ? $loc->getName() : "notset"; $loc_type = isset($loc) ? $loc->getType() : "notset"; $loc_lon = isset($loc) ? $loc->getLongitude() : "notset"; $loc_latt = isset($loc) ? $loc->getLattitude() : "notset"; $e['location_name'] = $location; $e['location_type'] = $loc_type; $e['location_lattitude'] = $loc_latt; $e['location_longitude'] = $loc_lon; $longdesc = $e[Event::EVENT_LONGDESC]; $sections = explode("||sec||", $longdesc); foreach ($sections as $section) { $det = explode("||ttl||", $section);