Adding more pages and limiting the amount shown to this list

Connect with other users about what to run on your webhosting (and how to run it) here.
Post Reply
Squiggles
New to forums
New to forums
Posts: 7
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Tue Jul 26, 2011 9:55 pm

Adding more pages and limiting the amount shown to this list

Post by Squiggles »

Code: Select all

<?php
$con = mysql_connect("localhost","removed","removed");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("primary_petition", $con);

$result = mysql_query("SELECT * FROM signatures ORDER BY id ASC");

echo " <br />
<br />
<br /><center><table border='1'>
<tr>
<th>Signature Number</th>
<th>Name Provided</th>
</tr></center>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['id'] . "</td>";
  echo "<td>" . $row['name'] . "</td>";
  echo "</tr>";
  }
echo "</table>";




mysql_close($con);
?>


<HEAD>
<TITLE> Petition Names </TITLE>
<BODY> 
<BR>
<BR>
<br>
<a href=http://writtenms.info>Click here for the main page.</a>

 </BODY>
</HTML>


I was wondering if somebody could add a limit (say 10 names?) and a page (with next/previous) to this script. If you need to know the url it points to it's ?page=list
IcEWoLF
This is my homepage
This is my homepage
Posts: 1192
Joined: Thu Aug 10, 2006 9:41 pm
Contact:

Re: Adding more pages and limiting the amount shown to this

Post by IcEWoLF »

You mean you need to add pagination to this script?

If so see here: http://stackoverflow.com/questions/1547 ... on-in-html
Image
Image
Post Reply