Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Help me with db connection
bvn
April 2015
If I use 'type' => 'mysqli'
what do I have to write in 'dsn' option
'mysql:...' or 'mysqli:...'?
Seemed both are not working...
frocco
April 2015
[code]
<?php
/**
* The development database settings. These get merged with the global settings.
*/
return array(
'default' => array(
'connection' => array(
'dsn' => 'mysql:host=localhost;dbname=yourdtabase',
'username' => 'root',
'password' => 'password',
),
),
);
[/code]
bvn
April 2015
No, there is no 'type' => 'msqli'! Try to add it.
bvn
April 2015
It has one solution - not use 'dsn' option, and use 'hostname' and 'database' instead.
Harro
April 2015
Accepted Answer
dsn is used with a PDO config, so with 'type' => 'pdo'.
The other types, 'mysql' and 'mysqli' don't use the DSN, they use individual values:
/**
* Base PDO config
*/
'default' => array(
'type' => 'pdo',
'connection' => array(
'dsn' => '',
'username' => '',
'password' => '',
'persistent' => false,
'compress' => false,
),
'identifier' => '`',
'table_prefix' => '',
'charset' => 'utf8',
'collation' => false,
'enable_cache' => true,
'profiling' => false,
'readonly' => false,
),
/**
* Base MySQLi config
*
'default' => array(
'type' => 'mysqli',
'connection' => array(
'hostname' => '',
'username' => '',
'password' => '',
'database' => '',
'persistent' => false,
),
'identifier' => '`',
'table_prefix' => '',
'charset' => 'utf8',
'collation' => false,
'enable_cache' => true,
'profiling' => false,
'readonly' => false,
),
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,089
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
261
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
bvn
April 2015
frocco
April 2015
Harro
April 2015