ganie
06-06-2011, 09:53 AM
Okay, so here is my problem: I am wanting to use an old shopping cart I created during class when learning PHP. While this works perfectly fine on self-servers , i have ran into numerous problems with hostmonster, and my hope is that someone else here has ran across the same issues, and has a fix.
(file 1: "config.php")
<?php
$dbhost = "localhost";
$dbuser = "*******_****"; #omitted on post...
$dbpassword = "*********"; #omitted on post...
$dbdatabase = "*******_shoppingcart";
$siteurl = "www.*********.com";
?>
(file 2: "index.php")
<?php
require("config.php");
$db = mysql_connect($dbhost, $dbuser, $dbpassword);
mysql_select_db($dbdatabase, $db);
...
require("bar.php");
?>
problem is that every time this script tries to connect to the database, i get an error of not even attempting to use a password. I can still manually set the data, and this error goes away, but that is only part of the problem....
Also, when calling bar.php, the file tries to access $db, and gets an error. Possible solution might be calling variables as global, but I didn't think it would work, since taking the config.php variables and dropping them directly into index.php didn't fix the error.
Anyone have a few good solutions, or any ideas?
(file 1: "config.php")
<?php
$dbhost = "localhost";
$dbuser = "*******_****"; #omitted on post...
$dbpassword = "*********"; #omitted on post...
$dbdatabase = "*******_shoppingcart";
$siteurl = "www.*********.com";
?>
(file 2: "index.php")
<?php
require("config.php");
$db = mysql_connect($dbhost, $dbuser, $dbpassword);
mysql_select_db($dbdatabase, $db);
...
require("bar.php");
?>
problem is that every time this script tries to connect to the database, i get an error of not even attempting to use a password. I can still manually set the data, and this error goes away, but that is only part of the problem....
Also, when calling bar.php, the file tries to access $db, and gets an error. Possible solution might be calling variables as global, but I didn't think it would work, since taking the config.php variables and dropping them directly into index.php didn't fix the error.
Anyone have a few good solutions, or any ideas?