DB in Config help ???

Discussion in 'PHP' started by pulikuttann, Mar 12, 2007.

  1. #1
    I am a newbie in PHP.I have written some php scripts, but as many of DP members said I need to code the database connection in another file so that it is more secure.So how can I do that.

    Is it simply code the db connection in config file and include it to any file where I need the db connection ???

    I have seen a file type in most of the php projects with extension .inc.php.What is this ?

    I have coded some DB projects and works fine on my system but I can't work it fine on my hosting space.How to connect to db in host ???

    I use :

    But what is this user and password in hosting space ?
    I have created one database,user,password with phpmyadmin and give it but no use.

    In my project I am taking the user name,password and servername from input box and create a db but in hosting space I need to create database name first ??
     
    pulikuttann, Mar 12, 2007 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,841
    Likes Received:
    4,543
    Best Answers:
    123
    Trophy Points:
    665
    #2
    I've written a post in my blog: http://www.itamer.com/secure-file-locations/72/

    I'd recommend that the database connection script is held below the public directory. That way the script can't be called from a browser. The same goes for any password or config files.
     
    sarahk, Mar 12, 2007 IP