I've been scratching my head for a couple days now. What I'm
trying to do seems soooooo easy but it doesn't work. Maybe someone
can spot my problem in the code.
What I'm doing is breaking a single blob mysql field into
multiple "pages" by inserting a code snippet into the field. That
part works fine. The url for the page in question with a sample
article is
http://208.106.143.80/articles/articles.php?idq=141&cat=4&pg=1
The url contains the article id, article category and page
number. At the bottom of the page is the pagination that reloads
the page with another "page" of the article. The code for that is:
$totalpages = $total;
if ($totalpages > 1) {
echo "<p
style='text-align:right;'><strong>Page:</strong> ";
if ($i > 1) {
echo " <a
href='".$_SERVER['PHP_SELF']."?pg=".($i-1)."'><<
Prev</a> ";
}
for ($x = 1; $x <= $totalpages; $x++) {
if ($x == $i) {
echo "<strong>[".$x."]</strong> ";
}
else {
echo "<strong><a
href='".$_SERVER['PHP_SELF']."?pg=".$x."'>".$x."</a></strong>
";
}
}
if ($i < $total) {
echo " <a
href='".$_SERVER['PHP_SELF']."?pg=".$k."'>Next
>></a></p>";
}
}
Basically all I'm doing is throwing the new querystring pg=$x
to the end of the current page url and reloading the current page.
And that is the problem. Even though the page links look right in
the browser, it just keeps loading the same "page" over and over
again. I can go into the url in the browser and manually change
from page 1 to page 2, etc. and that works as it should.
Ideas from anyone smarter than I?
What am I missing here.