Page 1 of 1

pagination

Posted: Thu Oct 20, 2011 10:14 pm
by jauson

Code: Select all

<?php

include 'conn.php';

$query = "SELECT * FROM `r_user` ORDER BY `id` DESC LIMIT 0, 5";
$result = mysql_query($query);
?>
<html>
<head><title> PHP </title></head>
<body>
<h3> Database </h3><br>
<table border="1" align="center" width="600">
   <tr>
   <td align="center"><font size="2"><strong> ID </font></strong>
	  <td align="center"><font size="2"><strong> First Name </font></strong>
		<td align="center"><font size="2"><strong> Last Name </font></strong>
		  <td align="center"><font size="2"><strong> Priveledges </font></strong>
		    <td align="center"><font size="2"><strong> Username </font></strong>
		</tr>
			<?php while($rows = mysql_fetch_assoc($result)) { ?>
			<tr>
			<tr>
			<td> <? echo $rows ['id']; ?> </td>
			<td> <? echo $rows ['firstname']; ?> </td>
			<td> <? echo $rows ['lastname']; ?> </td>
			<td> <? echo $rows ['priveledges']; ?> </td>
			<td> <? echo $rows ['username']; ?> </td>
			</tr>
		<? }
			mysql_close();
		?>
	</table>
</html>
I want to make this page with pagination can you show me how to work at it?

Re: pagination

Posted: Sat Oct 22, 2011 10:54 pm
by twinedev
I had written up a good sample and example, however since this is in the tutorials section, I have to toolbar to allow me to post code here on how to achieve it with the code you have. Unfortunately, I closed the the virtual machine I wrote it on, and lost the file I played with. If I get time, I'll try to rewrite it and submit some other way where I can paste it as code (too ugly to just post here)

Re: pagination

Posted: Thu Oct 27, 2011 6:23 pm
by mikeashfield
This seems to explain it clearly enough for me:

http://php.about.com/od/phpwithmysql/ss ... nation.htm