Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2005
    Location
    EIB Network
    Posts
    474

    * Numerous web apps using same mysql DB

    I am fairly new to mySQL/php and am interested in developing numerous web applications on my website that all require the same user/password. One of the apps will be a diet logbook, another will be a product review app, and another will be a book review section.

    Since all these apps will be in their own seperate folders, can I still use the same mySQL database for all of these apps??? If a visitor signs up on my site, I want their user/pass to be used for all the apps on my site. Is this doable even though the apps are located in different directories??? THanks.

  2. #2
    Join Date
    Dec 2004
    Location
    New York City, NY, USA
    Posts
    735
    Yes.

    With MySQL you can create multiple users and multiple passwords. It is good security to give a separate login/password to each site--though, since you intend on using one database, it won't give you any more security, unless you spend time granting permissions on a per-table basis.

  3. #3
    Yes you can use the same MySQL user and password in all your scripts. Just create a new file called mysql.php and write in there your connection's details:

    mysql_connect(.......);
    mysql_select_db(......);

    Once you have saved the file, include this one in your scripts whenever you need it:

    include(mysql.php);
    FDCServers - Bad Speed, Faulty Network, Ignorant Support

  4. #4
    Join Date
    Aug 2005
    Location
    EIB Network
    Posts
    474
    Thanks guys! that's great news...

    msmp3...

    Where should I place this mysql.php (having the connect and select_db functions in it) on my server??? Thanks!

  5. #5
    Join Date
    Sep 2005
    Location
    Cleveland, Ohio
    Posts
    51
    place the file in a directory not available to web visitors. /home/username/public_html then you'd put it in /home/username or /home/username/somethingelse

    you don't want a file containing username/password info under a public web directory. if for some reason php stopped working and didn't parse the file, it would be outputted as plain text to the visitor in their web browser. keeping the file outside of the public web directory prevents this.
    Jim Lundeen
    Edgar Technologies

    Professional Small Business IT Management
    http://edgar-tech.com

Posting Permissions

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