more testing
This commit is contained in:
+8
-51
@@ -5,40 +5,7 @@ error_reporting(E_ALL);
|
||||
header("refresh: 300;");
|
||||
$myDate = date('Y-m-d');
|
||||
$chart = "Combo-$myDate.png";
|
||||
$mysqli = mysqli_connect();
|
||||
$mysqli->select_db('birds');
|
||||
|
||||
if ($mysqli->connect_error) {
|
||||
die('Connect Error (' .
|
||||
$mysqli->connect_errno . ') '.
|
||||
$mysqli->connect_error);
|
||||
}
|
||||
|
||||
// SQL query to select data from database
|
||||
$sql0 = "SELECT COUNT(*) AS 'Total' FROM detections";
|
||||
$totalcount = $mysqli->query($sql0);
|
||||
|
||||
$sql1 = "SELECT Com_Name, Sci_Name, Date, Time FROM detections
|
||||
ORDER BY Date DESC, Time DESC LIMIT 1";
|
||||
$mostrecent = $mysqli->query($sql1);
|
||||
|
||||
$sql2 = "SELECT COUNT(*) AS 'Total' FROM detections
|
||||
WHERE Date = CURDATE()";
|
||||
$todayscount = $mysqli->query($sql2);
|
||||
|
||||
$sql3 = "SELECT COUNT(*) AS 'Total' FROM detections
|
||||
WHERE Date = CURDATE()
|
||||
AND Time >= DATE_SUB(NOW(),INTERVAL 1 HOUR)";
|
||||
$lasthourcount = $mysqli->query($sql3);
|
||||
|
||||
$sql4 = "SELECT Com_Name
|
||||
FROM detections
|
||||
WHERE Date = CURDATE()
|
||||
GROUP BY Com_Name";
|
||||
$specieslist = $mysqli->query($sql4);
|
||||
$speciescount = mysqli_num_rows($specieslist);
|
||||
|
||||
$mysqli->close();
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
@@ -77,27 +44,17 @@ a {
|
||||
<h2>Overview</h2>
|
||||
<div class="row">
|
||||
<div class="column2">
|
||||
<?php // LOOP TILL END OF DATA
|
||||
while($rows=$mostrecent ->fetch_assoc())
|
||||
{
|
||||
$dbname = preg_replace('/ /', '_', $rows['Com_Name']);
|
||||
$dbname = preg_replace('/\'/', '', $dbname);
|
||||
$dbsciname = preg_replace('/ /', '_', $rows['Sci_Name']);
|
||||
?>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Most Recent Detection</th>
|
||||
<td><a href="/By_Common_Name/<?php echo $dbname;?>"><?php echo $rows['Com_Name'];?></a></td>
|
||||
<td><a href="/By_Date/<?php echo $rows['Date'];?>"/><?php echo $rows['Date'];?></a></td>
|
||||
<td><?php echo $rows['Time'];?></td>
|
||||
<td><a href="https://wikipedia.org/wiki/<?php echo $dbsciname;?>" target="top"/>More Info</a></td>
|
||||
<td><a href="/By_Common_Name/"></a></td>
|
||||
<td><a href="/By_Date/"/></a></td>
|
||||
<td></td>
|
||||
<td><a href="https://wikipedia.org/wiki/" target="top"/>More Info</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="column">
|
||||
@@ -110,9 +67,9 @@ while($rows=$mostrecent ->fetch_assoc())
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Number of Detections</th>
|
||||
<td><?php while ($row = $totalcount->fetch_assoc()) { echo $row['Total']; };?></td>
|
||||
<td><?php while ($row = $todayscount->fetch_assoc()) { echo $row['Total']; };?></td>
|
||||
<td><?php while ($row = $lasthourcount->fetch_assoc()) { echo $row['Total']; };?></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -120,7 +77,7 @@ while($rows=$mostrecent ->fetch_assoc())
|
||||
<table>
|
||||
<tr>
|
||||
<th>Species Detected Today</th>
|
||||
<td><?php echo $speciescount;?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user