View Full Version : Pages

07-21-2009, 09:47 AM
In my site I need to make a list, but I also need it to create a page for every 5 items on the list. For an example, it would be similar to a forum section, like when theres 20 topics posted, a new page is made. How could this be done?
I know I didnt give alot of info, so if you need any more info jsut ask.

07-21-2009, 10:11 AM
It's known as pagination (http://en.wikipedia.org/wiki/Pagination). Search for PHP+mysql+pagination if you are using these items.

07-21-2009, 11:09 AM
Thanks now Im on the right track, but Im having issues, I got this guide on how to add it but with this, switching between pages doesnt work. It only stays on page one...

Heres the Pages script:

// First we check if we are on page one. If we are then we don't need a link to the previous page or the first page so we do nothing. If we aren't then we generate links to the first page, and to the previous page.
if ($pagenum == 1)
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1'> <<-First</a> ";
echo " ";
$previous = $pagenum-1;
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous'> <-Previous</a> ";

//just a spacer
echo " ---- ";

//This does the same as above, only checking if we are on the last page, and then generating the Next and Last links
if ($pagenum == $last)
else {
$next = $pagenum+1;
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next'>Next -></a> ";
echo " ";
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last ->></a> ";

If this isnt enough, all psot the whole code...

Edit: I jsut realized that when clicking next, it goes to page 2 but the info stays the same, after that it doesnt go to pg3, when clicking last pg it goes to the last page.

Also, it doesnt display the previous page button, so it must be something with the page number stuff?

07-24-2009, 11:20 AM
It has never been easier to create web pages. Just a couple of years ago, you need to have pretty good knowledge of website authoring skills to even create a decent web page. You need to learn programming language such as HTML to start. And even so, you probably spend a lot of time trying to debug your web page. You spend a lot of time because there are no available tool that can help you with the website creation process.

Today, it is so much easier. If you just want a simple blog, it can be done easily with tools that are readily available. You can easily find websites that allow you to create web pages for zero cost base on some standard template. These sites typically allow you to upload the standard media such as sound clips, movie, pictures etc. However, as you begin to get excited and want to do more, such websites may start charging you for the usage.http://chipsahoy.unlockmyarchive.info/35/c/wink.gif