-
fetch()) {
?>
- ">
prepare("SELECT a.id, a.date, a.title, a.text, a.video, a.video_type, (case when img.id is not null then count(*) else 0 end) as imgNum FROM article a LEFT JOIN image img on a.id = img.article WHERE a.is_live='Y' AND a.permalink=? AND a.category=1 GROUP BY a.id, a.date, a.title, a.text;"); $stmt->bind_param('s', $permalink); if (!$stmt->execute()) { //echo $stmt->error; } $stmt->bind_result($id, $date, $title, $text, $video, $videoType, $imgNum); if (!$stmt->fetch()) { //echo $stmt->error; } $stmt->close(); $customTitle = $title; $menu = 0; // Next and previous article permalinks $nextPermalink = $prevPermalink = ""; $nextStmt = $mysqli->prepare("SELECT next.permalink FROM article this LEFT JOIN article next ON this.id <> next.id WHERE this.id=? AND ((next.date = this.date AND next.id > this.id) OR next.date > this.date) AND next.is_live = 'Y' AND next.category=1 ORDER BY next.date ASC, next.id ASC LIMIT 1;"); $nextStmt->bind_param('i', $id); $nextStmt->execute(); $nextStmt->bind_result($nextPermalink); if (!$nextStmt->fetch()) { //echo $nextStmt->error; } $nextStmt->close(); $prevStmt = $mysqli->prepare("SELECT prev.permalink FROM article this LEFT JOIN article prev ON this.id <> prev.id WHERE this.id=? AND ((prev.date = this.date AND prev.id < this.id) OR prev.date < this.date) AND prev.is_live = 'Y' AND prev.category=1 ORDER BY prev.date DESC, prev.id DESC LIMIT 1;"); echo $mysqli->error; $prevStmt->bind_param('i', $id); $prevStmt->execute(); $prevStmt->bind_result($prevPermalink); if (!$prevStmt->fetch()) { //echo $prevStmt->error; } $prevStmt->close(); $platnicaPath = "http://www.imagocenter.si".prvaSlikaNovice($largePath, $id, $mysqli); $additionalMeta = ''; $additionalMeta .= ''; $additionalMeta .= ''; $additionalMeta .= ''; // Article image $stmtImg = $mysqli->prepare("SELECT name, alt FROM image WHERE article = ? ORDER BY sort ASC, id DESC"); $stmtImg->bind_param('i', $id); $stmtImg->execute(); $stmtImg->bind_result($imgName, $imgAlt); ?>