[REVIEW] database constructor

Last reviewed: Not reviewed
phpDocumentor

database constructor

The constructor for the database class.

Syntax

void database ( [ string $host ] , string $user, string $pass, string $db [, string $prefix
                                              [, string $driver [, string $nullDate ]]] )

$host
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
is the username required to connect to the database.
$pass
is the password associated with $user to be used to connect to the database.
$db
is the name of the database.
$prefix
is the string that will be prefixed to all table names.  From Joomla 1.1 this parameter is optional and if omitted will default to 'mos_'.
$driver
is the database driver name.  This parameter is optional and if omitted will default to an empty string.  This parameter was introduced in Joomla 1.1.
$nullDate
is the string to be used to represent a null date. This parameter is optional and if omitted will default to the null date string defined in the $mosConfig_zero_date entry in the Joomla configuration file.  This parameter was introduced in Joomla 1.1.

Examples

Example:

$host = 'localhost';
$user = 'joomlauser';
$password = 'itsasecret';
$dbase = 'test';
$dbprefix = 'jos_';
$db = new database( $host, $user, $password, $dbase, $dbprefix );

Please report any errors on this page to the Developer Documentation Forum.

Last Updated ( Monday, 25 December 2006 )