= 0) {
/* Creating a new mysql query */
$query = mysql_query("select id from $news_tabel limit ". ($site - $per_page) .",$per_page");
/* Gathering the number of rows in the mysql query ($query) above */
$prev_num = mysql_num_rows($query);
}
else {
$prev_num = 0;
}
/* Making a query that is used to display html */
$sql = mysql_query("select * from $news_tabel ORDER BY $news_order_by DESC LIMIT $site,$per_page") or die(mysql_error());
/* Making a div tag */
echo "
";
// Settings
// int: Number of items on page
$pageLength = 3;
$currentPage = $_GET["underside"];
// Capture items in database
$totalNumberOfPosts = mysql_result(mysql_query("SELECT COUNT(id) AS total FROM $news_tabel"),0);
$currentPage = (int)$_GET['underside'];
$numberOfPages = ceil($totalNumberOfPosts/$pageLength);
// Generating links
$links = array();
$links[] = $currentPage - 1 > 0 ? "
<< Previous" : '<< Previous';
for ($i=0;$i<$numberOfPages;$i++) {
// if current page == counter, add [].
$links[] = $currentPage == $i ? '
['.$i.']' : '
'.$i.'';
}
$links[] = $currentPage + 1 < $numberOfPages ? "
Next >>" : 'Next >>';
echo implode(' ',$links);
/*Using the $sql to create the entrys and displaying it in html */
while ($row = mysql_fetch_array($sql)) { ?>
" class="floatleft" alt="Me" />
0 ? "
<< Previous" : '<< Previous';
for ($i=0;$i<$numberOfPages;$i++) {
// if current page == counter, add [].
$links[] = $currentPage == $i ? '
['.$i.']' : '
'.$i.'';
}
$links[] = $currentPage + 1 < $numberOfPages ? "
Next >>" : 'Next >>';
echo implode(' ',$links);
echo "
";
?>