some tips for you. 1. INCREASE ITS SIZE, small pagination not good. .2. MAKE THE CLICK-ABLE AREA LARGER. 3. MAKE IT OBVIOUS.
All obvious...and nothing to do with the original posters question. Kurt what language are you using? I have a PHP class I created for Pagination.
[h=3]1. Obtain the required page number[/h][h=3]2. Identify how many database rows are available[/h][h=3]3. Calculate number of $lastpage[/h][h=3]4. Ensure that $pageno is within range[/h][h=3]5. Construct LIMIT clause[/h][h=3]6. Issue the database query[/h] [h=3]7. Construct pagination hyperlinks[/h]
What have you already made? You can show us your code, and then we will help you. Except that, you can use ready solutions, google it.
<?php /************************************************************************************************** * ================================================================================================= * PHP mySQL Paging Class 1.0 * class_resultpaging.php * - DESCRIPTION * A PHP function that enables you to create page links for your database results. * Function will return formatted page links and mySQL LIMIT code. * ================================================================================================= * Author: Jay Juliano - jayjuliano@gmail.com * Created: 12/23/2008 (When I should of been wrapping presents!) * ================================================================================================= * Copyright 2008-2009 - NetStar Interactive LLC * ================================================================================================= * You are free to use, distribute, and modify this software under the terms of the * GNU General Public License. See http://www.gnu.org/copyleft/gpl.html for more details. **************************************************************************************************/ class ResultPaging { function getPageLinks($sql, $params = "") { $__ResultPaging_DisplayPages = 5; $__ResultPaging_ResultsPerPage = 10; $__ResultPaging_PageParam = "page"; if (!isset($sql)) die("Missing SQL for getPageLinks()\n"); $params = isset($params) ? $params : ""; if ($params && !preg_match("/&$/", $params)) $params .= "&"; $params = preg_replace("/^&/", "", $params); $params = preg_replace("/^\?/", "", $params); $page = ""; if (!isset($_GET[$__ResultPaging_PageParam]) || !is_numeric($_GET[$__ResultPaging_PageParam]) || $_GET[$__ResultPaging_PageParam] == 0) { $page = 1; } else { $page = $_GET[$__ResultPaging_PageParam]; } $total_results = mysql_num_rows(mysql_query($sql)); $total_pages = 0; if ($total_results) $total_pages = ceil($total_results / $__ResultPaging_ResultsPerPage); if ($page > $total_pages) $page = $total_pages; $starting_record = ($page * $__ResultPaging_ResultsPerPage) - $__ResultPaging_ResultsPerPage; if ($starting_record < 0) $starting_record = 0; $start_page = ""; $end_page = ""; if ($total_pages == 0) { $start_page = 0; $end_page = 0; } else if ($total_pages <= $__ResultPaging_DisplayPages) { $start_page = 1; $end_page = $total_pages; } else { $page_set = ceil($page / $__ResultPaging_DisplayPages) - 1; $start_page = ($page_set * $__ResultPaging_DisplayPages) + 1; if ($total_pages < $start_page + $__ResultPaging_DisplayPages - 1) { $end_page = $total_pages; } else { $end_page = ($start_page + $__ResultPaging_DisplayPages) - 1; } } $previous_pageset_end = $start_page - 1; $next_pageset_start = $end_page + 1; $previous_pageset_start = $previous_pageset_end - $__ResultPaging_DisplayPages + 1; $next_pageset_end = $next_pageset_start + $__ResultPaging_DisplayPages - 1; $previous_page = $page - 1; $next_page = $page + 1; $first_record = $starting_record + 1; $last_record = $first_record + $__ResultPaging_ResultsPerPage - 1; if ($total_results < $last_record) $last_record = $total_results; /************************************************************************************************** * Format Link Pages **************************************************************************************************/ $pagesHTML = "<div id=\"pagesHTML\" style=\"width: 100%; border-bottom: 1px solid #000000; font-family: verdana, arial; font-size: 8pt;\">"; if ($first_record == 1 && $total_results < 1) $first_record = 0; $pagesHTML .= "<div id=\"pagesHTMLListing\" style=\"width: 33%; float: left;\">Listing $first_record-$last_record of $total_results</div>"; $pagesHTML .= "<div id=\"pagesHTMLPages\" style=\"width: 33%; float: left;\">"; if ($total_results > 0) { if ($start_page > $__ResultPaging_DisplayPages) $pagesHTML .= "<a href=\"" . $_SERVER['PHP_SELF'] . "?" . $params . "page=1\" title=\"Page 1\" style=\"font-weight: bold;\">1</a> <a href=\"" . $_SERVER['PHP_SELF'] . "?" . $params . "page=$previous_pageset_end\" title=\"‹‹ Pages $previous_pageset_start-$previous_pageset_end\" style=\"font-weight: bold;\">‹‹</a> "; for ($i = $start_page; $i <= $end_page; $i++) { if ($i == $page) { $pagesHTML .= "<span style=\"font-weight: bold;\">$i</span> "; } else { $pagesHTML .= "<a href=\"" . $_SERVER['PHP_SELF'] . "?" . $params . "page=$i\" title=\"Page $i\" style=\"font-weight: bold;\">$i</a> "; } } if ($end_page != $total_pages) $pagesHTML .= "<a href=\"" . $_SERVER['PHP_SELF'] . "?" . $params . "page=$next_pageset_start\" title=\"Pages $next_pageset_start-$next_pageset_end ››\" style=\"font-weight: bold;\">››</a> of <a href=\"" . $_SERVER['PHP_SELF'] . "?" . $params . "page=$total_pages\" title=\"Page $total_pages\" style=\"font-weight: bold;\">$total_pages</a>"; } $pagesHTML .= "</div>"; $pagesHTML .= "<div id=\"pagesHTMLPageSwitches\" style=\"width: 33%; float: left; text-align: right;\">"; if (($page > 1 && $page <= $total_pages) || ($page < $total_pages)) { $pagesHTML .= " "; if ($page > 1 && $page <= $total_pages) $pagesHTML .= "<a href=\"" . $_SERVER['PHP_SELF'] . "?" . $params . "page=$previous_page\" title=\"‹ Previous Page $previous_page\" style=\"font-weight: bold;\">‹ Previous</a>"; if (($page > 1 && $page <= $total_pages) && ($page < $total_pages)) $pagesHTML .= " | "; if ($page < $total_pages) $pagesHTML .= "<a href=\"" . $_SERVER['PHP_SELF'] . "?" . $params . "page=$next_page\" title=\"Next Page $next_page ›\" style=\"font-weight: bold;\">Next ›</a>"; } $pagesHTML .= "</div>"; $pagesHTML .= "<div style=\"clear: left;\"></div>"; $pagesHTML .= "</div>"; $limit_sql = "LIMIT $starting_record, $__ResultPaging_ResultsPerPage"; return array($pagesHTML, $limit_sql); } } ?> PHP: Usage: #... include "class_resultpaging.php"; #... $q = $_GET['q']; $sql = "SELECT name, address, address2, city, state, state_prefix, name_url, zip, phone, type, gender, orientation FROM Whatever WHERE MATCH (name, city) AGAINST ('" . safe($q) . "')"; $paging = new ResultPaging(); $pagelinkArray = $paging->getPageLinks("$sql;", "q=$q"); $pageLinks = $pagelinkArray[0]; $pageLimit = $pagelinkArray[1]; $result = mysql_query("$sql $pageLimit;"); #... ... PHP: $sql holds the initial query which is passed to the class... The class will then run the query and figure out how many pages and return the SQL with the SQL Limit info... Then you run the new query like shown above... $pageLinks will now hold the HTML for the paging with the current page etc. The query string "page" is used top identify current page and requested page... $q is additional query string appended to each page link... Play around with it and you will figure it out...
wow im really confused sorry, im not that great with php yet.. the page that is put on is this http://www.motorbikecentral.com/supercross race reviews.php this is the code that gets the data from my database. <?php require('connect.php'); $result = mysql_query("SELECT * FROM supercross_race_reviews ORDER BY id DESC") or die(mysql_error()); echo "<table width='90%' cellspacing='10'>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<tr><td>"; // arrow echo ("<img src='arrow.gif'>"); echo " "; // article name echo '<a style="font-size: 25px" href="'. $row['url'] .'">'. $row['article_name'] .'</a>'; echo "</td></tr><tr><td>"; // author + date echo $row['author']; echo " "; echo $row['date']; echo "</td></tr><tr><td>"; // Description echo "Brief Decription : "; echo " "; echo $row['description']; echo "<hr /></td></tr>"; } ?> PHP:
The class I posted simply generates the appropriate html for the page links and handles the SQL query. It will return the query for you to run that will return the results.