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.
create .ini file for mysql database connection.
Moderator: General Moderators
-
prasadb2005
- Forum Newbie
- Posts: 7
- Joined: Tue May 19, 2009 1:18 am
Re: create .ini file for mysql database connection.
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";
}