public static function createEpisodeEditLog($episode, $editLogEntry) { $editDate = date("n/j/Y g:i:s A"); // insert the episode edit log into the database $dbStatement = Util::getDbConnection()->prepare("INSERT " . "INTO EpisodeEditLog " . "( " . "EpisodeID, " . "SchemeID, " . "ImageID, " . "IsLinkable, " . "IsExtendable, " . "AuthorMailto, " . "AuthorNotify, " . "Title, " . "Text, " . "AuthorName, " . "AuthorEmail, " . "EditDate, " . "EditLogEntry " . ") " . "SELECT EpisodeID, " . "SchemeID, " . "ImageID, " . "IsLinkable, " . "IsExtendable, " . "AuthorMailto, " . "AuthorNotify, " . "Title, " . "Text, " . "AuthorName, " . "AuthorEmail, " . ":editDate, " . ":editLogEntry " . "FROM Episode " . "WHERE EpisodeID = :episode"); $dbStatement->bindParam(":editDate", $editDate, PDO::PARAM_STR); $dbStatement->bindParam(":editLogEntry", $editLogEntry, PDO::PARAM_STR); $dbStatement->bindParam(":episode", $episode, PDO::PARAM_INT); $dbStatement->execute(); if ($dbStatement->rowCount() != 1) { throw new HardStoryException("Unable to insert the episode edit log into the database."); } $episodeEditLogID = Util::getLastInsertId(); // insert the link edit log into the database $dbStatement = Util::getDbConnection()->prepare("INSERT " . "INTO LinkEditLog " . "( " . "EpisodeEditLogID, " . "TargetEpisodeID, " . "IsBackLink, " . "Description " . ") " . "SELECT :episodeEditLogID, " . "TargetEpisodeID, " . "IsBackLink, " . "Description " . "FROM Link " . "WHERE SourceEpisodeID = :episode " . "ORDER BY LinkID"); $dbStatement->bindParam(":episodeEditLogID", $episodeEditLogID, PDO::PARAM_INT); $dbStatement->bindParam(":episode", $episode, PDO::PARAM_INT); $dbStatement->execute(); return $episodeEditLogID; }