unknown mysql server host (11001)
Posted: Wed Aug 01, 2007 5:08 am
hello,
i'm new to php and i'm currently working with some php codes. i'm trying to make a connection to mysql with the codes below but was given an error "Unknown MySQL server host 'DB_HOST' (11001)". if i replace $rst with "$rst = @mysql_connect("11.22.333.44", "username", "password");", it works fine. any help will be much appreciated. tia
//include.conf
//db.conf
i'm new to php and i'm currently working with some php codes. i'm trying to make a connection to mysql with the codes below but was given an error "Unknown MySQL server host 'DB_HOST' (11001)". if i replace $rst with "$rst = @mysql_connect("11.22.333.44", "username", "password");", it works fine. any help will be much appreciated. tia
Code: Select all
<?
include_once("conf/include.conf");
$rst = @mysql_connect(DB_HOST, DB_UID, DB_PASSWD);
if (!$rst){
echo( "<p>Unable to connect to database manager.</p>");
die('Could not connect: ' . mysql_error());
exit();
} else {
echo("<p>Successfully Connected to MySQL Database Manager!</p>");
}
if (! @mysql_select_db(DB_DATABASE) ){
echo( "<p>Unable to connect database...</p>");
exit();
} else {
echo("<p>Successfully Connected to Database 'Production'!</p>");
}
?>Code: Select all
<?
session_start();
include_once("db.conf");
?>Code: Select all
<?
define("DB_HOST", "11.22.333.44");
define("DB_UID", "username");
define("DB_PASSWD", "password");
define("DB_DATABASE", "test");
?>