32 lines
937 B
PHP
32 lines
937 B
PHP
<?php
|
|
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
|
|
require "$root/database/credentials.php";
|
|
|
|
// Connect the database
|
|
try {
|
|
$db = new PDO("mysql:host=$host;dbname=$database;charset=utf8",
|
|
$user,
|
|
$password,
|
|
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
|
|
));
|
|
} catch (Exception $e) {
|
|
die("Error : ".$e->getMessage());
|
|
}
|
|
|
|
$req = $db->prepare('SELECT id, recordist_name, file_name, license, species, sound_type, date, time FROM `records` ORDER BY `entry_timestamp` ASC LIMIT 1');
|
|
$req->execute();
|
|
if ($data = $req->fetch())
|
|
{
|
|
?>
|
|
<div class="sound">
|
|
<h3><?=$data['file_name']?></h3>
|
|
<h4><em><?=$data['species']?></em></h4>
|
|
<p>Recorded on <?=$data['date']?> at <?=$data['time']?></p>
|
|
<audio src="<?="../storage/records/".$data['file_name']?>" controls></audio>
|
|
<p><?=$data['license']?> <?=$data['recordist_name']?></p>
|
|
</div>
|
|
<?php
|
|
} else {
|
|
echo "Error fetch.";
|
|
}
|
|
?>
|