Closes a persistent connection to AS/400 server.
bool i5_pclose ([resource connection])
Parameters
connection |
Connection resource - result from i5_connect() or i5_pconnect()
|
Return
True if OK, false if failed.
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 |
Details
Closes the connection associated with the specified resource or the last opened connection.
Connection is physically closed. See i5_close() to keep connection open by i5_pconnect()
Example
$conn = i5_pconnect("193.104.118.120", "QPGMR", "PASSWORD");
if (!$conn)
{
$error = i5_error();
echo " Error during connection<BR>";
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 <BR>";
$isnew = i5_get_property(I5_NEW_CONNECTION, $conn);
if ($isnew)
{
echo " New connection. Do some job initialization <BR>";
/* Leaves connection without closing it. */
/* Make it available for another script. */
$ret = i5_close($conn);
if (!$ret)
trigger_error("i5_close error : ".i5_errormsg(), E_USER_ERROR);
}
else
{
$ret = i5_pclose($conn);
if (!$ret)
trigger_error("i5_pclose error : ".i5_errormsg(), E_USER_ERROR);
}
}
echo " I5 disconnected<BR>";
See also
i5_close
i5_connect
i5_pconnect