MAXDB_CONNECT_ERROR(3) 1 MAXDB_CONNECT_ERROR(3)maxdb_connect_error - Returns a string description of the last connect errorSYNOPSIS
string maxdb_connect_error (void )
DESCRIPTION
The maxdb_connect_error(3) function is identical to the corresponding maxdb_connect_errno(3) function in every way, except instead of
returning an integer error code the maxdb_connect_error(3) function will return a string representation of the last error to occur for the
last maxdb_connect(3) call. If no error has occurred, this function will return an empty string.
RETURN VALUES
A string that describes the error. An empty string if no error occurred.
EXAMPLES
Example #1
maxdb_connect_error sample
<?php
$link = maxdb_connect("localhost", "nonexisting_user", "");
if (!$link) {
printf("Can't connect to localhost. Error: %s
", maxdb_connect_error());
}
?>
The above example will output something similar to:
PHP Warning: maxdb_connect(): -4008POS(1) Unknown user name/password combination <...>
Can't connect to localhost. Error: POS(1) Unknown user name/password combination
SEE ALSO maxdb_connect(3), maxdb_connect_errno(3), maxdb_errno(3), maxdb_error(3), maxdb_sqlstate(3).
PHP Documentation Group MAXDB_CONNECT_ERROR(3)
Check Out this Related Man Page
MAXDB_CONNECT(3) 1 MAXDB_CONNECT(3)maxdb_connect - Open a new connection to the MaxDB server
Procedural style
SYNOPSIS
resource maxdb_connect ([string $host], [string $username], [string $passwd], [string $dbname], [int $port], [string $socket])
DESCRIPTION
Object oriented style
maxdb::__construct ([string $host], [string $username], [string $passwd], [string $dbname], [int $port], [string $socket])
The maxdb_connect(3) function attempts to open a connection to the MaxDB Server running on $host which can be either a host name or an IP
address. Passing the string "localhost" to this parameter, the local host is assumed. If successful, the maxdb_connect(3) will return an
resource representing the connection to the database or FALSE on failure.
The $username and $password parameters specify the username and password under which to connect to the MaxDB server. If the password is
not provided (the NULL value is passed), the MaxDB server will attempt to authenticate the user against the $maxdb.default_pw in php.ini.
The $dbname parameter if provided will specify the default database to be used when performing queries. If not provied, the entry
$maxdb.default_db in php.ini is used.
The $port and $socket parameters are ignored for the MaxDB server.
RETURN VALUES
Returns a resource which represents the connection to a MaxDB Server or FALSE if the connection failed.
EXAMPLES
Example #1
Object oriented style
<?php
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (maxdb_connect_errno()) {
printf("Connect failed: %s
", maxdb_connect_error());
exit();
}
printf("Host information: %s
", $maxdb->host_info);
/* close connection */
$maxdb->close();
?>
Example #2
Procedural style
<?php
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (!$link) {
printf("Connect failed: %s
", maxdb_connect_error());
exit();
}
printf("Host information: %s
", maxdb_get_host_info($link));
/* close connection */
maxdb_close($link);
?>
The above example will output something similar to:
Host information: localhost
PHP Documentation Group MAXDB_CONNECT(3)