I'm trying to add PREV NEXT and make the current page into just text like [2]
I can't seem to get it to work correctly.
Here's the current code:
$per_row = 3; // Number of images you want per row
$per_page = 9;
if($cmd != 'adv_gallery' && $cmd != 'search_catagory'){
// Assign variables
echo ("<table><tr>
<tr>
<td colspan=$per_row>
$headString
<center>Image Gallery<center>
</td>
</tr>
<tr>
<td colspan=$per_row>
$fontString2
<form action=$PHP_SELF?cmd=search_catagory method=post>
<select name=catagory>
");
$result1 = @mysql_query("SELECT * FROM gallery_catagory");
while ($row1 = mysql_fetch_array($result1)) {
extract($row1);
echo("
<option value=$id>$cat_name</option>
");
}
echo("
</select><input type=submit value=\"Search Catagory\"></form>
</td>
</tr>
<tr>
<td colspan=$per_row bgcolor=$tablebg>
$fontString2
<center>Catagory: ALL<center>
</td>
</tr>
");
if($page == NULL) {
$page = 0;
}
else {
$page = $page - 1;
}
$startNum = $page;
$result77 = @mysql_query("SELECT COUNT(*) FROM gallery");
$count = mysql_fetch_array($result77);
$count = $count[0];
$num_pages = ($count /$per_page) +1;
$limit = $per_page+ $startNum * $per_page;
$i =0;
$x = 1; // Counter variable
$sql = "SELECT * FROM gallery ORDER BY date DESC, id DESC";
$result = mysql_query($sql);
while (($row = mysql_fetch_array($result)) && $i < $limit) {
extract($row);
if($i >= ($startNum * $per_page)) {
$img = eregi_replace("gif","jpg",$img);
echo ("
<td height=130 width=150 valign=bottom><center><a href=$PHP_SELF?id=$id&cmd=adv_gallery
title='POSTED BY: $author'>
<img src = /gallery/thumbs/$img border=0></a><br><centeR>
$fontString <a href=$PHP_SELF?id=$id&cmd=adv_gallery
title='POSTED BY: $author'><center>$quick_name</a></centeR></td>");
if ( $x == (int)$per_row )
{
echo "</tr>";
$x = 1;
}
else
{
$x++;
}
}
$i++;
}
echo ("<tr><td colspan=$per_row bgcolor=$tablebg>$fontString2<center>PAGE</center></td></tr></table>");
for($i = 1; $i <= $num_pages; $i++) {
echo("$fontString <a href=$PHP_SELF?page=$i> $i </a>");
}
}
the only want I could get it to work at all, it comes up with 1 1 2 2 and only every other one is a link.
I want to add the NEXT and PREV, that's probably fairly easy, but I can't get it to grab out the current page and make that into just text.
Thanks in advance.