Documentation

Connect

bool
CDatabase::Connect(
 string host,
 string db,
 string login,
 string password
)

The method opens a conection to the database. Returns "true" on successful connection or "false" otherwise. Non-static method.

Parameters

ParameterDescription
host Database server (host).
db Database name.
login Login.
password Password.

See Also

Examples of use

<?
if(!($DB->Connect($DBHost, $DBName, $DBLogin, $DBPassword)))
{
	if(file_exists($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/php_interface/dbconn_error.php"))
	{
		include($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/php_interface/dbconn_error.php");
	}
	else
	{
		include($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/include/dbconn_error.php");
	}
	die();
}
?>


© «Bitrix24», 2001-2024
Up