<?php $page_title = "Tourney details"; include_once 'include/header.php'; session_start(); // get ID of the tourney to view details $id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: missing ID.'); // include database and object files include_once 'database/dbconfig.php'; include_once 'objects/tourney.php'; // get database connection $database = new Database(); $db = $database->getConnection(); // prepare tourney object $tourney = new Tourney($db); // set ID property of tourney $tourney->id = $id; // read the details of tourney $tourney->readOne(); ?> <h3> <?php echo "{$tourney->title}"; ?> </h3> <div style="padding-bottom: 20px;"> <span style="font-weight: bold;">Description</span> <div> <?php echo "{$tourney->description}"; ?>
<?php $page_title = "Tourney list"; include_once 'include/header.php'; // get database connection include_once 'database/dbconfig.php'; include_once 'objects/tourney.php'; $database = new Database(); $db = $database->getConnection(); $tourney = new Tourney($db); // query all tourneys $stmt = $tourney->readAll(); $num = $stmt->rowCount(); // display the tourneys if there are any if ($num > 0) { //$category = new Category($db); echo "<table class='table table-hover table-responsive table-bordered'>"; echo "<tr>"; echo "<th>Id</th>"; echo "<th>Title</th>"; echo "<th>Description</th>"; echo "<th>Category</th>"; echo "<th>Actions</th>"; echo "</tr>"; while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { extract($row); echo "<tr>"; echo "<td>{$id}</td>"; echo "<td><a href=\"/tourney/viewTourney.php?id={$id}\">{$title}</a></td>"; echo "<td>{$description}</td>"; echo "<td>";