Closes connection to AS/400 server.
bool i5_close |
([resource connection] ) |
connection |
Connection resource - result from i5_connect() or i5_pconnect()
|
Returns:
True if OK, false if failed.
Error returned
I5_ERR_PHP_HDLDFT |
256 |
No default connection found. |
I5_ERR_PHP_HDLCONN |
257 |
This resource has no connection active. |
I5_ERR_PHP_RESOURCE_BAD |
261 |
No resource found . |
I5_ERR_PHP_TYPEPARAM |
262 |
Type of element x in parameter -1 must be y. Type z was provided. |
I5_ERR_PHP_NBPARAM_BAD |
263 |
Wrong parameter count |
Closes the connection associated with the specified resource or the last opened connection.
If the connection was opened with i5_pconnect(), the connection will not be totally closed. Use i5_pclose() to physically close it.
i5_close() is automatically executed at the end of PHP script.
/* Connection error detail in case of failure */
$conn = i5_connect("193.104.118.120", "QPGMR", "PASSW");
if (!$conn) {
$error = i5_error();
echo " Error during connection\n";
echo "<BR> Error number: ".$error["num"];
echo "<BR> Error category: ".$error["cat"];
echo "<BR> Error message: ".$error["msg"];
echo "<BR> Error description: ".$error["desc"];
trigger_error("I5 connection fails", E_USER_ERROR);
} else {
echo " Connection OK ";
}
/* Disconnect from AS/400 */
$ret = i5_close($conn);
If ($ret){
echo " I5 disconnected ";
} else {
$ret = i5_errormsg($conn);
}