Page 1 of 1

create .ini file for mysql database connection.

Posted: Thu Jun 18, 2009 1:05 pm
by prasadb2005
Hi,
I want to create a .ini file to make a connection with mysql database.

It is said that that file contains all the details of variables like server name, username, password,database name and connection.

I am using WAMP server for mysql GUI and netbeans 6.5.1 editor for php.

I din't create .ini file before this.
Please help me to create the .ini file for making database connection with mysql.

Re: create .ini file for mysql database connection.

Posted: Thu Jun 18, 2009 1:44 pm
by yacahuma
you want to create a file that contains your connection parameters for your code?? First dont call it .ini always use .php

Code: Select all

 
$host     = "localhost";
$database = "database";
$username = "username";
$password = "password";
 
require_once "adodb/adodb-exceptions.inc.php";
require_once 'adodb/adodb.inc.php';
try
{
  $GLOBAL_CN = NewADOConnection('mysql');
  $GLOBAL_CN->SetFetchMode(ADODB_FETCH_ASSOC);
  $GLOBAL_CN->Connect($host, $username, $password,$database);
  $GLOBAL_CN->debug = false;
 // $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
} catch (exception $e) {
        var_dump($e);
        adodb_backtrace($e->gettrace());
//    $msg = "Unable to conect to Database";
}