Sexified some code. PDO'd the shit out of some sql query.

This commit is contained in:
Rudi Grinberg 2012-09-04 15:26:12 -04:00
parent 398215f1d0
commit 1d758db42b
1 changed files with 22 additions and 18 deletions

View File

@ -615,17 +615,22 @@ class Application_Model_Show
$con = Propel::getConnection();
$showId = $this->getId();
$sql = "SELECT first_show, start_time, timezone FROM cc_show_days"
." WHERE show_id = $showId"
$stmt = $con->prepare(
"SELECT first_show, start_time, timezone FROM cc_show_days"
." WHERE show_id = :showId"
." ORDER BY first_show"
." LIMIT 1";
." LIMIT 1");
$query = $con->query($sql);
$stmt->bindParam(':showId', $showId);
$stmt->execute();
if ($query->rowCount() == 0) {
//$query = $con->query($sql);
if (!$stmt) {
return "";
} else {
$rows = $query->fetchAll();
}
$rows = $stmt->fetchAll();
$row = $rows[0];
$dt = new DateTime($row["first_show"]." ".$row["start_time"], new DateTimeZone($row["timezone"]));
@ -633,7 +638,6 @@ class Application_Model_Show
return $dt->format("Y-m-d H:i");
}
}
/**
* Get the start date of the current show in UTC timezone.