Method: ::getDatabase($dbname)

Public static method of the InvDB singleton object used to get an instance of a database connection object anywhere in the code. $this->inv_db exists in most contollers, so this would normally be used to either obtain an instance of the default database in a supporting class, or for getting a connetion to a different database.

Arguments:

$dbname (STRING) - identifier for a database connection string in your website config.

Returns:

OBJECT - database connection object

Example:

// Gets a database connection object for a database in your config called 'shoedb'
$obj_shoe_db = InvDB::getDatabase('shoedb');

Example 2:

// Gets the default database connection object.
$obj_db = InvDB::getDatabase('default');

Contact Us

Address: 22a Fishergate York, YO10 4AB · Tel: 01904 636677 · Email: info@dotadmin.com