Forum Moderators: coopster

Message Too Old, No Replies

need help with pagination

pagination help needed

         

nQQb

10:39 pm on Oct 3, 2007 (gmt 0)

10+ Year Member



I need to do pagination for this page, current set for 25 records at a time. I would like to show at bottom 1 . 2 . 3 .....8.9.10 etc etc .

here's the code:


<p><b><?=strtoupper($_GET["listtype"]."S")?> LIST</b></p>
<?
$conn=mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname) or die ('Could not connect: ' . mysql_error());
// print "Connected to MySQL";

$query="SELECT * FROM t_media WHERE m_type=\"".$_GET["listtype"]."\" ORDER BY m_id ASC LIMIT 0, 25";
//echo $query;
$qresult = mysql_query($query);

?>
<table width="100" cellpadding="2" cellspacing="1" border="0">
<tr bgcolor="#CCCCCC">
<td>#</td><td>ID</td><td>Title</td><td>Action</td>
</tr>
<?
$i=0;
while ($line = mysql_fetch_assoc($qresult)){
$i++;
?>

<tr class="rowText" <? if($count%2==0) echo 'style="background-color:#FFFFCC; "';?>">
<td nowrap="nowrap"><?=$i?></td><td nowrap="nowrap"><?=$line["m_id"]?></td><td nowrap="nowrap"><?=$line["m_title"]?></td><td nowrap="nowrap"><a href="/<?=$line["m_type"]?>s/<?=$line["m_url"]?>" target="_blank">View</a> / <a href="index.php?action=editmedia&mediatype=<?=$line["m_type"]?>&mediaid=<?=$line["m_id"]?>">Edit</a> / <a href="index.php?action=deletemedia&mediatype=<?=$line["m_type"]?>&mediaid=<?=$line["m_id"]?>" onClick="if(confirm('Are you sure you want to delete?')) window.location='index.php?action=deletemedia&mediatype=<?=$line["m_type"]?>&mediaid=<?=$line["m_id"]?>'">Delete</a></td>
</tr>

<?}?>
</table>
<?
mysql_close($conn);
?>

eelixduppy

1:11 am on Oct 4, 2007 (gmt 0)



Hello and Welcome to WebmasterWorld! :)

Here's a little thread that shows how you can get that accomplished: [webmasterworld.com...]

Please try you best to implement the solution and if you have any trouble on the way we will be glad to assist you.

good luck