View Full Version : Root HTML/PHP files accessing PHP/MySQL files in sub-folder

11-18-2010, 12:25 AM
Sorry if this has been discussed .. I'm not too keen on PHP and verbage.

I just installed a php/mysql shopping cart into a subfolder on my linux server hosted by GoDaddy.

I want to be able to access the database from my host files in the root folder but i'm unable to do so (all files are php files already). Is this something that can be done? Like i said, i'm new to php and not very knowledgeable. Thanks!

11-18-2010, 10:30 PM
Hey Dizzle,

You shouldn't have any issue doing that. Try the code below...

$conn = mysql_connect("localhost", "root", [password]) or
die ("Could not connect to database");

$conn_id = mysql_select_db([dbname]) or
die ("Could not select database");