globals not working?
| From: | Paul Kaiser | Date: | Fri, 04 Oct 2002 16:55:40 +0000 |
| Subject: | globals not working? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-118891@lists.php.net to get a copy of this message | ||
I have an odd problem.
I have a file called "evt_to_web.php". This file contains some variable
assignments and a few functions.
I have used
require_once "evt_to_web.php";
in another file, indextest.php.
In indextest.php, I then call a function that is in evt_to_web.php.
That function cannot seem to see it's own global variables, even though I
have used "global <etc>;".
I'm pulling my hair out.
Here is "evt_to_web.php":
$evthostname = "localhost";
$evtusername = "paukai";
$evtpassword = "imctiger88";
$evtdatabase = "imc_evts";
$evtevents_table = "evt_events"; // Table where all events will be stored.
$evtclient_table = "evt_clients"; // The owners of events and their login
info
$evtcategory_table = "evt_cats"; // Small table with categories for event
sorting
// Administration password
$evtadmin_password = "imccalendar";
$evtimg_dir = "images/";
// Webmaster, in case of error:
$evtwebmaster = "paukai@illinimedia.com";
// Redir site in case of error:
$evtredir_site = "http://www.illinimedia.com/";
function testGlobal() {
global $evtredir_site;
echo "TestGlobal: '$evtredir_site'<br>\n";
}
When I do "testGlobal();" I get:
TestGloal: ''
Showing me that the function testGlobal thinks that $everedir_site is empty.
What have I done wrong here??
Thanks,
Paul Kaiser