|
Posted by J.O. Aho on 10/10/27 11:39
m6s wrote:
> I'd like to make my database variables globally available through a
> class OR global values where this file would be included and so the
> variables would be seen from any script that I run.
>
> Can someone tell me the way?
make a file, let call it database.php
in your database.php you store the variables/class you want, eg
<?PHP
$database_user='root';
$database_pass='1234';
?>
Then in all the scripts you want to use these variables, you add this line
before you use them
include_once('database.php');
or even better one with a full path to the file
include_once('/var/www/localhost/database.php');
After this, you can use the variables $database_user and $database_pass with
the values set in your database.php.
//Aho
Navigation:
[Reply to this message]
|