Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added basic single view page.

  • Loading branch information...
commit cd3ea03dcc89172c681ae63d8a5155049857d11a 1 parent 38841c2
@thomasjbradley thomasjbradley authored
Showing with 44 additions and 0 deletions.
  1. +44 −0 single.php
View
44 single.php
@@ -0,0 +1,44 @@
+<?php
+
+$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
+
+if (empty($id)) {
+ header('Location: index.php');
+ exit;
+}
+
+require_once 'includes/db.php';
+
+$sql = $db->prepare('
+ SELECT id, name, adr, lat, lng
+ FROM dinobones
+ WHERE id = :id
+');
+
+$sql->bindValue(':id', $id, PDO::PARAM_INT);
+$sql->execute();
+$results = $sql->fetch();
+
+if (empty($results)) {
+ header('Location: index.php');
+ exit;
+}
+
+$title = $results['name'];
+
+include 'includes/theme-top.php';
+
+?>
+
+<h1><?php echo $results['name']; ?></h1>
+<dl>
+ <dt>Address</dt><dd><?php echo $results['adr']; ?></dd>
+ <dt>Longitude</dt><dd><?php echo $results['lng']; ?></dd>
+ <dt>Latitude</dt><dd><?php echo $results['lat']; ?></dd>
+</dl>
+
+<?php
+
+include 'includes/theme-bottom.php';
+
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.