Skip to content

Instantly share code, notes, and snippets.

Created July 8, 2015 04:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/219d65c81d5f80e4090a to your computer and use it in GitHub Desktop.
Save anonymous/219d65c81d5f80e4090a to your computer and use it in GitHub Desktop.
incidents
<html>
<head>
<title>Incidents</title>
</head>
<body>
<h1>Incidents</h1>
<?php
$link = mysqli_connect('158.69.21.149', 'root', 'JXHzcS1F97PUVB5z3p35m5LH', 'db);
$result = $link->query("SELECT subject, time, details FROM incidents WHERE time > DATE_SUB(NOW(), INTERVAL 30 DAY) ORDER BY id DESC LIMIT 20");
$foundAny = false;
while($row = mysqli_fetch_array($result)) {
$foundAny = true;
echo "<h2>{$row['subject']} ({$row['time']})</h2>";
echo "<p>{$row['details']}</p>";
}
if(!$foundAny) {
echo "<b>There have not been any incidents in the last thirty days.</b>";
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment