From 27ea00f5d477f9416db1f36bae9ab13fc250482a Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 4 Sep 2012 13:50:13 -0400 Subject: [PATCH] Refactored sql substition into pdo --- airtime_mvc/application/models/Show.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 046b95739..b033e18b9 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1620,12 +1620,17 @@ class Application_Model_Show $startTimeString = $today_timestamp->format("Y-m-d H:i:s"); } - $sql = "SELECT * FROM cc_show_days - WHERE last_show IS NULL - OR first_show < '{$endTimeString}' AND last_show > '{$startTimeString}'"; + $con->prepare(" + SELECT * FROM cc_show_days + WHERE last_show IS NULL + OR first_show < :endTimeString AND last_show > :startTimeString"); - //Logging::info($sql); - $res = $con->query($sql)->fetchAll(); + $stmt = $con->execute(array( + ':endTimeString' => $endTimeString, + ':startTimeString' => $startTimeString + )); + + $res = $stm->fetchAll(); foreach ($res as $row) { Application_Model_Show::populateShow($row, $p_endTimestamp); }