| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Database |
JDatabase |
__construct |
__construct() |
Never | Work in Progress |
The constructor for the database class. The construct is responsible for opening a connection to the database and setting any necessary settings.
JDatabase __construct ( $host, $user, $pass, $db, $table_prefix )
| $host | string | is the URL of the system that is hosting the database. Usually ‘localhost’. This parameter is optional and if omitted will default to ‘localhost’. |
| $user | string | is the username required to connect to the database. |
| $pass | string | is the password associated with $user to be used to connect to the database. |
| $db | string | is the name of the database. |
| $table_prefix | string | is the string that will be prefixed to all table names. From Joomla! 1.5 this parameter is optional and if omitted will default to ‘jos_’. |
Example
$host = 'localhost'; $user = 'joomlauser'; $password = 'itsasecret'; $dbase = 'test'; $dbprefix = 'jos_'; $db = new JDatabase( $host, $user, $password, $dbase, $dbprefix );