['default' => 1]]); } else{ $page_id = 1; } // Attempt select query execution try{ $sql = 'SELECT id, date, stub, text FROM news WHERE id = :id'; if($stmt = $pdo->prepare($sql)){ $stmt->bindParam(":id", $param_id, PDO::PARAM_STR); $param_id = $page_id; if($stmt->execute()){ if($stmt->rowCount() == 1){ if($row = $stmt->fetch()){ $article_data = array( 'date' => date('d.m.Y', strtotime($row['date'])), 'stub' => $row['stub'], 'id' => $row['id'], 'text' => $row['text'] ); } } else { unset($stmt); unset($pdo); http_response_code(404); include('/en/404.html'); die(); } } // Close statement unset($stmt); } } catch(PDOException $e){ die('ERROR: Could not able to execute $sql. ' . $e->getMessage()); } ?>