Hello All:
I am some difficulties getting some database variables from an included file to my mysql connection. Here is what i have:
file one Called config.inc.php:
session_register("client_id");
$_SESSION['client_id'] = $_SESSION['SESS_ACCT_ID'];//
$club_id=$_SESSION['client_id'];
ob_start();
include('../../../page_title.php');
ob_end_clean();
include('../../../datalogin.php');
if (!defined('DEFAULT_HOST')) define('DEFAULT_HOST','localhost');
if (!defined('DEFAULT_USER')) define('DEFAULT_USER',$account_user);
if (!defined('DEFAULT_PASS')) define('DEFAULT_PASS',$account_pass);
if (!defined('DEFAULT_DB')) define('DEFAULT_DB',$account_db);
the variables inside the define() are from the included datalogin.php.
Now, from my second file:
include('config.inc.php');
$link = @mysql_connect(DEFAULT_HOST, DEFAULT_USER, DEFAULT_PASS);
//var_dump($link);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
# mysql_query("SET SESSION time_zone = '-0:00';");
#mysql_query("SET NAMES 'utf8'", $link);
$db_selected = mysql_select_db(DEFAULT_DB, $link);
if (!$db_selected) {
die ("Cannot use database: ".DEFAULT_DB.mysql_error());
}
I'm unable to pass the variable to both:
$link = @mysql_connect(DEFAULT_HOST, DEFAULT_USER, DEFAULT_PASS);
and
$db_selected = mysql_select_db(DEFAULT_DB, $link);
However, I can echo (or print) to screen of:
DEFAULT_DB
DEFAULT_HOST
DEFAULT_USER
DEFAULT_PASS
Any ideas as to what is happening with the lost of the values in the db connection string