I'm new to PHP, and i start to use XAMPP to build the site. I have code below
db.php:
<?php
$hostName='localhost';
$userName='xxxxxxxxx';
$userPass='xxxxxxxxx';
?>
and a test.php:
<?php
include 'db.php';
echo $hostName;
?>
but now it show me Notice: Undefined variable: hostName
what i found is the register_globals need to set "on" in php.ini, but after i set, the XAMPP show: Directive 'register_globals' is no longer available in PHP when i restart XAMPP.
i move the same code to Hosting24 but it's work, anyone can help?
register_globals
which is indeed removed from PHP.require
instead ofinclude
- if you get an error, there is a problem loading thedb.php
file (could be caused by a lot of things)