graham23s Posted September 11, 2008 Share Posted September 11, 2008 Hi Guys, This is more than likely something really simple but when i load my pagination page the "Next" link isn't showing! if i tamper with the url like: admin.php?page=customer_management&page-no=2 it shows the links for "Prev" fine and works as it should! it just doesn't show me the link on the first page to goto page 2 code: <?php $page_number = $_GET['page-no']; if (intval($page_number) < 1) { $page_number = 1; } $max = 10; $num = $page_number * $max - $max; // grab the customers // $q_customers = "SELECT * FROM `fcp_customers`"; $r_customers = mysql_query($q_customers) or die (mysql_error()); $a_customers = mysql_num_rows($r_customers); // Pagination query $p_pagination = "SELECT * FROM `fcp_customers` LIMIT $num, $max"; $r_pagination = mysql_query($p_pagination) or die (mysql_error()); $a_pagination = mysql_num_rows($r_pagination); // start the table // print("<table width='95%' border='0' cellpadding='5' cellspacing='1' class='tbl_login' />\n"); print("<tr>\n"); print("<td align='center' class='c3'><b>ID</b></td><td align='center' class='c3'><b>First Name</b></td><td align='center' class='c3'><b>Last Name</b></td><td align='center' class='c3'><b>Registered</b></td><td align='center' class='c3'><b>Last Login</b></td><td align='center' class='c3'><b>Country</b></td><td align='center' class='c3'><b>Action</b></td>\n"); print("</tr>\n"); print("<tr class=\"c5\">\n"); print("<td align=\"left\"><img src=\"images/pixel.gif\" width=\"1\" height=\"1\"></td><td align=\"left\"><img src=\"images/pixel.gif\" width=\"1\" height=\"1\"></td><td align=\"left\"><img src=\"images/pixel.gif\" width=\"1\" height=\"1\"></td><td align=\"left\"><img src=\"images/pixel.gif\" width=\"1\" height=\"1\"></td><td align=\"left\"><img src=\"images/pixel.gif\" width=\"1\" height=\"1\"></td><td align=\"left\"><img src=\"images/pixel.gif\" width=\"1\" height=\"1\"></td><td align=\"left\"><img src=\"images/pixel.gif\" width=\"1\" height=\"1\"></td>\n"); print("</tr>\n"); // while loop // while($row = mysql_fetch_array($r_pagination)) { $cus_id = $row['id']; $cus_fname = $row['first_name']; $cus_lname = $row['last_name']; $cus_country = $row['country']; $cus_reg_date = $row['registered']; $cus_last_login = $row['last_logged_in']; // format the date // $cus_reg_pretty = date("F j, Y, g:i a", strtotime($cus_reg_date)); $cus_last_login_pretty = date("F j, Y, g:i a", strtotime($cus_last_login)); // include the coutry flags // include("inc/inc-flags.php"); // alternate border color $row_color = ($row_color == "class=\"no_color\"") ? "class=\"c1\"" : "class=\"no_color\""; print("<tr $row_color><td class=\"font_for_forms\" align='left'>$cus_id</td><td class=\"font_for_forms\" align='left'>$cus_fname</td><td class=\"font_for_forms\" align='left'>$cus_lname</td><td class=\"font_for_forms\" align='left'>$cus_reg_pretty</td><td class=\"font_for_forms\" align='left'>$cus_last_login_pretty</td><td class=\"font_for_forms\" align='center'>$flag</td><td class=\"font_for_forms\" align='center'><a class='smart_links' href='admin.php?page=view_customers&customer_id=$cus_id'>View</a> | <a class='smart_links' href='admin.php?page=edit_customers&customer_id=$cus_id'>Edit</a> | <a class='smart_links' href='admin.php?page=delete_customer&customer_id=$cus_id'>Delete</a></td></tr>\n"); } print("</table>"); $totalpage = ceil($a_pagination/$max) + 1; $total_results = ceil($a_pagination/$max); $prevlink = ($page_number - 1); $nextlink = ($page_number + 1); // styling // print("<br /><div id='container'>"); // previous link // if($page_number > 1) { echo "<a class=\"page_links\" href=\"admin.php?page=customer_management&page-no=$prevlink\">Prev</a></span> \n"; } for($i = 1; $i < $totalpage; $i++) { if ($i == $page_number) { echo "<span class=\"page_links\">$i</span> \n"; } else { echo "<a class=\"page_links\" href=\"admin.php?page=customer_management&page-no=$i\">$i</a></span> \n"; } } if($page_number < $totalpage - 1) { echo "<a class=\"page_links\" href=\"admin.php?page=customer_management&page-no=$nextlink\">Next</a></a>\n"; } print("</div><br />"); ?> i have went over it for days lol thanks guys Graham Link to comment https://forums.phpfreaks.com/topic/123823-pagination-link-not-showing/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.