instant $5 for your help (pagination code help)

Discussion in 'PHP' started by nQQb, Oct 3, 2007.

  1. #1
    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);
    ?>
    PHP:
    please help
     
    nQQb, Oct 3, 2007 IP
  2. DebugMe

    DebugMe Active Member

    Messages:
    106
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #2
    Just wait for a few minutes :)
     
    DebugMe, Oct 3, 2007 IP
  3. DebugMe

    DebugMe Active Member

    Messages:
    106
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Yepp.. Please take a look at your P.M. box.
     
    DebugMe, Oct 3, 2007 IP
  4. nQQb

    nQQb Active Member

    Messages:
    332
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #4
    thanks for a great job! :D
     
    nQQb, Oct 3, 2007 IP
  5. nQQb

    nQQb Active Member

    Messages:
    332
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #5
    please close thread
     
    nQQb, Oct 3, 2007 IP