I just put a new server in with php5.0.4 and can only connect to the MySql database on the localhost. It will not connect to another MySql database. It will not even connect to the localhost database if I use the IP address instead of the name ‘localhost’.
MySql will connect to a remote host if I use a command line through MySql so I know the database is fine. I think it is my php config or maybe I need to add something to my code?
Here is the code that runs on my server running php4.2.2
This code also works for the local database if I change the variables to fit this server.
Code: Select all
require("../functions/db.php");
$wwwdb_name = get_db_name(); //returns the db name
$wwwtable_name = "ITEM";
$wwwhostname = get_db_hostname(); //returns the host name or address
$wwwusername = get_db_username(); //returns the user name.
$wwwsql_password = get_db_password(); //returns the pw
$wwwconnection = @mysql_connect($wwwhostname, $wwwusername, $wwwsql_password) or die("Err");
$dbwww = @mysql_select_db($wwwdb_name, $wwwconnection) or die("Could Not Select Database. www ");Any ideas