Product Documentation

FairCom SQL for PHP

Previous Topic

Next Topic

ctsql_connect

Open a connection to FairCom DB SQL

Declaration

resource ctsql_connect ( [string dbname [, string username [, string password]]])

Description

ctsql_connect() establishes a connection to FairCom DB SQL.

The dbname parameter is formatted as one of the usual FairCom DB database names shown below:

  • port#@hostname:database
  • port#@hostname
  • hostname:database
  • database (e.g. “6597@localhost:ctreeSQL”)

The link to the server will be closed as soon as the execution of the script ends, unless it’s closed earlier by explicitly calling ctsql_close().

Returns

Returns a c-treePHP connection identifier on success, or FALSE on failure.

Example

<?php

$link = ctsql_connect('ctreeSQL', 'admin', 'ADMIN');

if (!$link) {

die('Failed to connect to FairCom DB SQL: ' . ctsql_error());

}

echo 'Successfully connected to FairCom DB SQL';

ctsql_close($link);

?>

See also

ctsql_pconnect(), ctsql_close().

TOCIndex