Question about links when using pagination

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikegotnaild
Forum Contributor
Posts: 173
Joined: Sat Feb 14, 2004 5:59 pm

Question about links when using pagination

Post by mikegotnaild »

when adding myfile.php?page=$variable ex. acoustic.php?page=2 ... Is '2' an actual php page. Is it temporarly created? I dont understand this. Because when i run my script and try to go to page=2 "page 2" It says there is no such file.
tylerdurden
Forum Commoner
Posts: 66
Joined: Mon Jul 28, 2003 11:52 am
Location: Austria

Post by tylerdurden »

Unfortunately it's not as easy as that. You probably saw this on someone else's site? The "page=2" bit has to be handled by your own PHP script, e.g. for including the second part of an article or returning the second 20 (or soomething) results from a database search. Nothing automatic here.
User avatar
uberpolak
Forum Contributor
Posts: 261
Joined: Thu Jan 02, 2003 10:37 am
Location: Next to the bar

Post by uberpolak »

"2" is a variable you can use in your script to include a page. Something like this...

Note: This is horribly unsecure, don't use it, just an example.

Code: Select all

<?php

include($_GET['page'] . '.php');
//will find a page called '2.php' and inlcude it

?>
Post Reply