<?php
$settings['hostname'] = '127.0.0.1';
$settings['username'] = 'root';
$settings['password'] = 'root';
$settings['database'] = 'band';
$settings['dbdriver'] = 'mysql';
/**
* DATABASE
*/
class database
{
protected $settings;
function __construct()
{
}
function connect()
{
$this->start = new PDO(
$this->settings['dbdriver'] . ':host='.
$this->settings['hostname'] . ';dbname='.
$this->settings['database'],
$this->settings['username'],
$this->settings['password'],
array(PDO::ATTR_PERSISTENT => true));
$this->start->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
}
}
?>
ok im still a student so today im learning about scope and connections database the question is how can i put the $settings out of the class in to the protected $settings in class ? is there a way ? or maybe you have a better way of doing it ?
thanks for looking in Adam Ramadhan