setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $e) { $message = $e->getMessage() . "\n" . $_SERVER['SCRIPT_FILENAME'] . "\n" . __LINE__ . "\n" . $_SERVER['HTTP_HOST'] . "/" . $_SERVER['REQUEST_URI']; #sendMailMandrill("Brett Aquila", "brett.aquila@gmail.com", "Brett Aquila", "brett@truckingtruth.com", "Database Error", $message, "DatabaseError"); } return $handle; } // issue the 404 message function issue404() { Header("HTTP/1.1 404 Not Found"); include $_SERVER['DOCUMENT_ROOT'] . "/404.html"; exit; } function checkFor404() { $handle = connectToTrainingBase2(); if (isset($_GET['newest']) && $_GET['newest'] !== "ALL"): $query = $handle->prepare("SELECT count(*) as count FROM photos"); $query->execute(); // we show 50 photos per page so make sure they didn't request a page beyond the number of photos we have while ($row = $query->fetch()) : $count = intval($row['count']); endwhile; if (ceil($count/50) < intval($_GET['newest'])): issue404(); endif; endif; } checkFor404(); ?> Trucker Photos - Trucking Truth Trucker Photos Page <?=$_GET['newest'];?> - Trucking Truth

Trucking Truth Photo Gallery