getFile()); terminate(); } // Subpage content ends // Simplog (blog posts etc) // Connect to db (it's down here to show the blogpage even in cases // where of failure to connect) require ("includes/dbconnect.php"); // Divide the posts into pages, N number of posts on every page if (isset($_GET['page'])) { $page = $_GET['page']; } else { $page=1; } $start = ($page-1) * $posts_per_page; // Fetch posts $query = "SELECT * FROM blog ORDER BY date DESC LIMIT $start, $posts_per_page"; $result = mysql_query($query) or terminate("No matching queries...
It seems you " . "either haven't started blogging yet or haven't " . "installed the the database table yet
"); // Printing posts in HTML while ($line = mysql_fetch_array($result)) { print "

$line[title]

\n

"; print "$line[posttext]\n
"; print "Posted on: $line[date]"; print "

\n\n"; } // Printing page links $query = "SELECT COUNT(title) FROM blog"; $result = mysql_query($query); $rows = mysql_fetch_row($result); $total_posts = $rows[0]; $total_posts = ceil($total_posts / $posts_per_page); print "Page: "; for ($i=1; $i<=$total_posts; $i++) { print "".$i." "; } print ""; // Close MySQL link require "includes/dbclose.php"; footer(); ?>