Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Root HTML/PHP files accessing PHP/MySQL files in sub-folder

    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!

  • #2
    New Coder
    Join Date
    Nov 2010
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hey Dizzle,

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

    Code:
    $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");


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •