Forum Moderators: coopster
When i write
www.example.com/results.php?page=7
then i should get some results [minimum 30 as in the thread example] Now on page 7 ; I should have four links
1> to previous page (page 6)
2> to next page (page 8)
3> to last page (page 120) assuming after page 120 no results are displayed
4> to first page (page 1)
so that means something similar to link combined with $_GET["pageNum"]
BUT HOW?
i wrote something like
<a href="<? echo $_SERVER['HTTP_HOST'];?>/results.php?page=$_GET["pageNum" + 1]>Next page</a> using above link how to show 1st and last page links(assuming the last page number is far higher than 120, and i don't know exact last number as it's dynamic!)
As shown above the can i make the latest content to display on page 1 and the oldest to show on page 120th .
What if i want reverse; latest on 120th page and oldest on 1st page
I have created a simple pagination. Now on a page display.php i want to display all the titles as a link
currently i have
[php]while($row = mysql_fetch_array($sql)){
// Build your formatted results here.
echo $row['id']."<br />";
echo $row['content']."<br />";
}[/php]
Instead i want something like
<a href="<?php echo $row['id']">$row['title']</a>
so that for corresponding id i get a corresponding page.
Also i want to give a link to last page . How to know the page number of last page.
the code below gives some parsing error like Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/mysite/public_html/pages.php on line 30
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$row['id']\">$row['title']</a>";