- Readme First! - Read and follow the rules, otherwise your posts will be closed
There are currently, 47 guest(s) and 0 member(s) that are online. You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - perpage global returning NULL [ ]
Author
Message
mjhufford
Nuke Soldier
Joined: Jul 09, 2005
Posts: 16
Location: Lowell, AR
Posted:
Thu Jul 13, 2006 8:58 am
Hi all,
I'm writing a file repository module and having trouble calling the $perpage global.
for example:
Code:
global $perpage;
echo "this is perpage: ".$perpage;
That returns "this is perpage: "
Any ideas? Where is this global stored? Do I need to call another global to get that one to return properly? Thanks!
TogetherTeam
Site Admin
Joined: May 28, 2004
Posts: 18
Posted:
Thu Jul 13, 2006 10:29 am
Are you trying to import the global variable from another page ?
Example:
If page1.php store a value in $perpage and you try to get $perpage value in page2.php, but you haven't included page1.php, this is an error.
Correct Example:
- page1.php -
<?
$perpage = 12345;
?>
- page2.php
<?
include("page1.php");
echo "Perpage: ".$perpage;
?>
_BAD_ Example:
- page1.php -
<?
$perpage = 12345;
echo '<a href="page2.php">Page2</a><br />';
?>
- page2.php -
<?
// global $perpage; <- is useless in this case !
echo "Perpage: ".$perpage;
?>
Bye,
Francesco.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum