Hey, I used the coding for making prev next links from one of the articles. I took off the next and prev part, and I just have the 1 2 3 4 result links. I was wondering if anyone knew how I could make it so that the page I'm on is not a link. For example, if I'm on page 4, then 1,2, and 3 are links, but 4 is just text. Here's what my coding looks like...
<?php
mysql_connect (host, uname, pwd);
mysql_select_db (table);
$limit=5; // rows to return
$numresults=mysql_query("SELECT results FROM " . table . " order by whatever DESC");
$numrows=mysql_num_rows($numresults);
if (empty($offset)) {
$offset=0;
}
$result=mysql_query("SELECT results FROM " . table . " order by whatever DESC limit $offset,$limit");
$pages=intval($numrows/$limit);
if ($numrows%$limit) {
$pages++;
}
//pages div begin
print ("<div align=right>Pages: ");
if (isset($pagenumber)) {
$start_limit = ($pagenumber-1) * $GLOBALS[topicsper];
} else {
$start_limit = 0;
}
for ($i=1;$i<=$pages;$i++) { // loop thru
$newoffset=$limit*($i-1);
if ($newoffset == $PHP_SELF)
{
print "$i ";
}
else
{
print "<a href=\"$PHP_SELF?offset=$newoffset\">$i</a> \n";
}
}
//pages div end
print ("</div>");
?>
I tried using an if statement to see if PHP_SELF equaled the offest, but it only works for page one. It doesn't work for the other pages. Here's the part that I did:
for ($i=1;$i<=$pages;$i++) { // loop thru
$newoffset=$limit*($i-1);
if ($newoffset == $PHP_SELF)
{
print "$i ";
}
else
{
print "<a href=\"$PHP_SELF?offset=$newoffset\">$i</a> \n";
}
}
If anyone can help me, I'd appreciate it...sorry about the sloppiness of this...if you have any questions, let me know.