ok so i have a pagination script im trying to get to work. now heres the thing with it, i called this file j1.php and tested it, it works great!
the problem is that im trying to use it on a different page where the url to the page is ?page=linkdump2 and its the same exact script but it wont work on this page. for examples i will provide links to the pages so you can see what im talking about
Working page (j1.php) and heres the second page with exact same script but doesnt work.
?page=linkdump2
any clue of how to fix this problem? i tried playing with the page links between different numbers but that didnt work either.
<?
function per_page($link, $offset) {
global $numofpages, $page;
$numofpages = round($numofpages);
$pagesstart = round($page-$offset);
$pagesend = round($page+$offset);
if ($page != "1" && round($numofpages) != "0") {
echo str_replace("%page", round($page-1), '<a href="'.$link.'"><font face="Trebuchet MS">«</font></a> ');
}
for($i = 1; $i <= $numofpages; $i++) {
if ($pagesstart <= $i && $pagesend >= $i) {
if ($i == $page) {
echo "<b>[$i]</b> ";
}
else {
echo str_replace("%page", "$i", '<a href="'.$link.'">'.$i.'</a> ');
}
}
}
if (round($numofpages) == "0") {
echo "[$i]";
}
if ($page != round($numofpages) && round($numofpages) != "0") {
echo str_replace("%page", round($page+1), '<a href="'.$link.'"><font face="Trebuchet MS">»</font></a>');
}
}
/* Connect to mysql */
$dbxzm=mysql_connect ("sql109.byethost6.com", "b6_903966", "batman123") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("b6_903966_main");
/* Set How many results to display per page */
$pp = "1";
/* Select the table that you want to view, you can add things like WHERE something='something' */
$table = "linkdump";
$total = mysql_result(mysql_query("SELECT COUNT(id) FROM $table"),0);
$numofpages = $total / $pp;
if (!isset($_GET['page'])) {
$page = 1;
}
else {
$page = $_GET['page'];
}
$limitvalue = $page * $pp - ($pp);
/* Display the rows */
$query = "SELECT * FROM $table LIMIT $limitvalue, $pp";
$result = mysql_query($query);
while($r=mysql_fetch_array($result))
{
echo "<div class=\"box\">";
echo "<div class=\"box_inner\">";
echo "<a href=\"$r[link]\" target=\"_blank\">$r[linkname]</a> <font color=\"008AFF\"> - $r[description]";
echo "</div>";
echo "</div>";
}
/* Display the pages down the bottom */
echo 'Pages: '.round($numofpages).'<br>';
per_page("?page=%page", "5");
?>
ALSO! when looking at the examples... 1st page is plain as u can see... 2nd is supposed to look like this with the yellow boxes (what the divs are for in the following code)
echo "<div class=\"box\">";
echo "<div class=\"box_inner\">";
echo "<a href=\"$r[link]\" target=\"_blank\">$r[linkname]</a> <font color=\"008AFF\"> - $r[description]";
echo "</div>";
echo "</div>";
last but not least... when switching pages on linkdump2 it just brings up the home page... any help would be greatly appreciated