prepare('SELECT COUNT(*) FROM Entries'); $count_query->execute(); $count = $count_query->fetch()[0]; echo '
Entries (' . $count . ' total)
'; // Prepare SELECT statement. $select = "SELECT name, message, show_info, show_ip, ip, submitted, browser_info FROM Entries ORDER BY submitted DESC"; $stmt = $db->prepare($select); // Execute statement. $stmt->execute(); // ID between 1 and 3. // Get the results. $results = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach($results as $row) { echo ''; $submittedRaw = $row['submitted']; $submittedDT = new DateTime("@$submittedRaw"); $submitted = $submittedDT->format('H:i:s - Y-m-d'); $browser = get_browser(null, true); $sys = $browser['parent'] . ' (' . $browser['platform_description'] . ' ' . $browser['platform_version'] . ')'; echo 'Name: ' . $row['name'] . PHP_EOL; if ($row['show_ip']) echo 'IP: ' . $row['ip'] . PHP_EOL; if ($row['show_info']) echo 'Sys: ' . $row['browser_info'] . PHP_EOL; echo 'Date: ' . $submitted . PHP_EOL . PHP_EOL; echo $row['message']; echo ' |
'; } ?>