Jump to content

Help Neede About The Php Pagination


kafia

Recommended Posts

hi every one if any one can help me with the code for pagination spose if i have 20 record from a mysql table how i can print that record on a page line wise and column wise for example if like the print 5 record in a row and 4 rows on page how it is please help me with a simple code example best regard

Link to comment
Share on other sites

first of all, you have to ouput the first 20 records. Then do the following:

<?php  //Set number of columns per <tr>  $ColsPerRow = 5;	echo "<table align='center'>";	echo "  <tr>";	$i=0;		//Loop trough the result of your query. In my case this is a photoalbum for a albumlist	while($AlbumTree = $db->sql_fetchrow($AlbumQuery)) 	{		  //if the last column is set, ouput <tr>	  if($i == $ColsPerRow)		{		  echo "<tr>";		}		else		{		  $i++;		}	  echo "  <td align='center' width='130'><a href='modules.php?name=photoalbum&album=".$AlbumTree["AlbumID"]."'><input type='image' src='".$AlbumTree["AlbumThumb"]."'><br /><strong>".$AlbumTree["AlbumCustomName"]."</strong></a></td>";	  if($i == $ColsPerRow)		{				  //after the last column set </tr>		  echo "</tr>";			$i=0;		}	}?>

I don't have any examples for pagination but justsomeguy helped you with that :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...