| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Database |
JDatabase |
getInstance |
getInstance() |
Never | Work in Progress |
Returns a reference to the global Database object, only creating it if it doesn’t already exist.
JDatabase &getInstance ( $option )
| $option | array | contains the parameters to be passed to the database driver. The database driver is specified by the $option[’driver’] parameter and if omitted defaults to ‘mysql’. |
To connect to the Joomla! database you should not call this method directly. Instead use the JFactory class as follows:
Getting a reference to the Joomla! database object
<?php $db = & JFactory::getDBO(); ?>