Fuel Documentation

Database Introduction

Introduction

Fuel offers a driver based database abstration layer. At the time of writing supported drivers are MySQL, MySQLi and PDO. Aside from regular database interaction, fuel also comes with a DBUtil class to perform database operations such as creating databases, adding fields and much more.

Please note that not all features are supported bij every driver.

Configuration

In order to begin working with databases, you must change the database settings. The database config file is located at APPPATH/config/db.php.

Database configurations are formated like so:

'dev' => array(
	'type'           => 'mysqli',
	'connection'     => array(
		'hostname'       => 'localhost',
		'port'           => '3306',
		'database'       => 'fuel_db',
		'username'       => 'your_username',
		'password'       => 'y0uR_p@ssW0rd',
		'persistent'     => false,
	),
	'table_prefix'   => '',
	'charset'        => 'utf8',
	'caching'        => false,
	'profiling'      => false,
),

Once you have your configuration in place, it's time to use it.