Page 1 of 1

Pagination Help!!

Posted: Sun Jun 22, 2008 12:15 pm
by kanchan
I have a pagination script here:

Code: Select all

<?
 
$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&nbsp</font></a>"; 
} 
 
for($i = 1; $i <= $total_pages; $i++){ 
    if(($page) == $i){ 
        echo "$i&nbsp;"; 
        } else { 
            echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\";>$i</a>&nbsp;"; 
    } 
} 
 
// Build Next Link 
if($page < $total_pages){ 
    $next = ($page + 1); 
    echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\";><font color=\"#6699CC\">Next</font></a>"; 
}
 
?>

Now what i want is

i want to put this codes into table like this :

Code: Select all

<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>

how can i put those codes into the table above??

Re: Pagination Help!!

Posted: Sun Jun 22, 2008 12:23 pm
by jayshields
Change your existing echo calls and perhaps add some new ones?

Re: Pagination Help!!

Posted: Sun Jun 22, 2008 12:40 pm
by kanchan
jayshields wrote:Change your existing echo calls and perhaps add some new ones?
what is that mean??
coz i m new to PHP so....

Re: Pagination Help!!

Posted: Sun Jun 22, 2008 2:34 pm
by Eran
basically, you would prefer to have someone write the code for you