Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004

    Unanswered: php access to mySQL db in different folder?

    hi all,

    newbie question ...

    i'm running a php interpreter and mySQL for windows on my local machine (xp pro pc). php files located inside my Inetpub/wwwroot folder run fine, so i assume the interpreter has been folded into IIS somehow. with the mySQL server running, i can connect to localhost.

    problem is, i created a test database from the mySQL command prompt, so it lives (by default) in the mysql/data folder. i'd like to access the mySQL database via my php scripts, regardless of where those two files reside.

    i tried to google my way through this, but nothing so far. if you've got any hints, i'd be into hearing.



  2. #2
    Join Date
    May 2004
    You basically need to create the database as a server object within you PHP scripts so you can draw information from it. This is a really common need so I am suprised you couldn't find what you need on google. I use ASP so I don't know the command sequences off the top of my head. has alot of PHP database tools that will work with MySQL. Take a look through those and see if you can find what you need.

  3. #3
    Join Date
    Jun 2004
    thanks for the reply.

    yeah, in ASP you'd just define the path as part of the connection string:

    set conn=Server.CreateObject("ADODB.Connection")
    conn.Open "c:/database/myDatabase.mdb"

    i guess i was looking for an analog in the PHP world. there're plenty of tutorials that talk about how to install the php and mySQL clients, and how to use php to connect to the mySQL server (and thence to the database). just nothing that talks about getting the php client to see databases that live in other folders.

    i'll keep googling.

Posting Permissions

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