From 1f975f948841eacd2cca2da39cfbe04d10e0e137 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sat, 13 Dec 2008 10:06:40 -0500 Subject: Fixed blog post Next/Previous links Previously, when a post was deleted, it's adjacent posts displayed nothing for the respective Next/Previous link because there was no post with an ID exactly one before or after it. Now, blog.php just looks for the next or previous ID, regardless of if it's actually adjacent. --- pages/blog.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pages') diff --git a/pages/blog.php b/pages/blog.php index 879aa0f..f99ad17 100755 --- a/pages/blog.php +++ b/pages/blog.php @@ -45,7 +45,7 @@ if (isset($_GET['post'])) $title = stripslashes($getpost3['title']) . ' - Blog Archive'; - $getback = "SELECT * FROM updates WHERE id = " . ($getpost3['id']-1); + $getback = "SELECT * FROM updates WHERE id < " . $getpost3['id'] . " ORDER BY id DESC LIMIT 0,1"; $getback2 = mysql_query($getback); $getback3 = mysql_fetch_array($getback2); if (isset($getback3['title'])) @@ -54,7 +54,7 @@ if (isset($_GET['post'])) 'TITLE' => $getback3['title'])); } - $getnext = "SELECT * FROM updates WHERE id = " . ($getpost3['id']+1); + $getnext = "SELECT * FROM updates WHERE id > " . $getpost3['id'] . " ORDER BY id ASC LIMIT 0,1"; $getnext2 = mysql_query($getnext); $getnext3 = mysql_fetch_array($getnext2); if (isset($getnext3['title'])) -- cgit 1.4.1