I have a pagination script here: <? $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM wallpapers"),0); $total_pages = ceil($total_results / $max_wp_results); echo "<b><strong>"; echo "<center>Pages</br>"; // Build Previous Link if($page > 1){ $prev = ($page - 1); echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\";><font color=\"#6699CC\">Previous </font></a>"; } for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "$i "; } else { echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\";>$i</a> "; } } // Build Next Link if($page < $total_pages){ $next = ($page + 1); echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\";><font color=\"#6699CC\">Next</font></a>"; } ?> Code (markup): Now what i want is i want to put this codes into table like this : <table border="0" cellpadding="2" cellspacing="2"> <tr> <td align="center" bgcolor="#000000" width="19"><font color="white"><b>1</b></font></td> <td width="19">2</td> <td width="19">3</td> <td width="19">4</td> <td width="19">5</td> <td>[next]</td> </tr> </table> HTML: how can i put those codes into the table above??
<? $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM wallpapers"),0); $total_pages = ceil($total_results / $max_wp_results); echo "<b><strong>"; echo "<center>Pages</br>"; // Build Previous Link if($page > 1){ $prev = ($page - 1); ?> <table border="0" cellpadding="2" cellspacing="2"> <tr> <td align="center" bgcolor="#000000" width="19"> <? echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\";><font color=\"#6699CC\">Previous </font></a> </td> "; } for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo " <td width=\"19\">$i </td>"; } else { echo " <td width=\"19\"><a href=\"".$_SERVER['PHP_SELF']."?page=$i\";>$i</a> </td>"; } } // Build Next Link if($page < $total_pages){ $next = ($page + 1); echo " <td width=\"19\"><a href=\"".$_SERVER['PHP_SELF']."?page=$next\";><font color=\"#6699CC\">Next</font></a></td>"; } echo "</tr></table>"; ?>
i got error, i.e: the pagination table goes to right side of the page.. i want that pagination table just below the "Pages" text..... could you please fixed that??
this is my code of my web page pagination: <?php //Create and print the Navigation bar $Nav=""; // if current page is not 1, draw PREVIOUS link if ($pg > 1 && $NumberOfPages != 0) { printf('<a href="showproducts.php?limit=%s&cid=%s&cat=%s&pg=%s"><</a>', ($limit), ($cid), ($cat), ($pg - 1)); } For($i = 1 ; $i <= $NumberOfPages ; $i++) { If($i == $pg) { $Nav .= " <a href=\"javascript:void(0)\" class=\"selected\"><b>$i</b></a>"; } else { $Nav .= " <a href=\"showproducts.php?limit=".$limit."&cid=$cid&cat=$cat&pg=".$i."\">$i</a>"; } } Echo "" . $Nav; // if current page less than max pages, draw NEXT link if ($pg < $NumberOfPages && $NumberOfPages != 0) { printf(' <a href="showproducts.php?limit=%s&cid=%s&cat=%s&pg=%s">></a>', ($limit), ($cid), ($cat), ($pg + 1)); } ?> PHP: