Viewing older news...
Posted: Fri Apr 30, 2010 12:21 pm
Hi,
I have this code to display the latest 5 news in my index page. How can i make a link at the end of the news to view older news?
Any help please?
I have this code to display the latest 5 news in my index page. How can i make a link at the end of the news to view older news?
Any help please?
Code: Select all
<?php
$select = "SELECT * FROM news ORDER BY PostDateTime DESC LIMIT 0,5";
$result = mysql_query($select);
while ($news = mysql_fetch_array($result)) {
echo "<div style=\"overflow: auto;\">";
echo "<hr style=\"border: 1px solid #06C\" />";
echo "<h3>" . stripslashes($news['Title']) . "</h3>";
echo "<small>posted on: " . date("d/m/Y H:i", strtotime($news['PostDateTime'])) . "</small>";
echo "<p>" . stripslashes(nl2br($news['Body'])) . "</p>";
echo "<hr style=\"border: 1px solid #06C\" />";
if (isset($_SESSION['user']) && $_SESSION['superadmin'] == true) {
echo "<div style=\"float: right;\"><a href=\"editnews.php?id=" . $news['NewsID'] . "\">Edit</a> | <a onclick=\"return confirm('Are you sure you want to delete this news?');\" href=\"deletenews.php?id=" . $news['NewsID'] . "\">Delete</a></div>";
}
echo "</div>";
}
?>