<?php //use files require_once 'classes/conference.php'; require_once 'classes/exceptions.php'; try { //create object with data $c = new Conference('AFC'); //display data echo $c->get_id() . ' : ' . $c->get_name(); echo '<br><img src="Images/Conferences/' . $c->get_image() . '"></img>'; } catch (RecordNotFoundException $ex) { echo $ex->get_message(); }
<?php if (isset($_GET['id'])) { //use files require_once 'classes/conference.php'; require_once 'classes/division.php'; require_once 'classes/exceptions.php'; //read parameter from url $id = $_GET['id']; try { //create object with data $c = new Conference($id); $json = '{"status" : 0, "id" : "' . $c->get_id() . '", "name" : "' . $c->get_name() . '", "image" : "' . $c->get_image() . '", "divisions" : ['; $first = true; foreach ($c->get_divisions() as $d) { if ($first) { $first = false; } else { $json .= ','; } $json .= '{"id" : "' . $d->get_id() . '", "name" : "' . $d->get_name() . '" }'; } $json .= ']}'; echo $json; } catch (RecordNotFoundException $ex) {
require_once 'classes/division.php'; require_once 'classes/exceptions.php'; //read parameter from url $id = $_GET['id']; try { //create object with data $c = new Conference($id); ?> <html> <head> </head> <body> <table border="1px"> <tr> <td><img src="Images/Conferences/<?php echo $c->get_image(); ?> "</img></td> <td><?php echo $c->get_name(); ?> </td> </tr> </table> <table border="1px"> <tr><td>Divisions</td></tr> <?php foreach ($c->get_divisions() as $d) { echo '<tr><td>' . $d->get_name() . '</td></tr>'; } ?>