The following example demonstrates how to return an error message and
SQLCODE value after deliberately passing invalid parameters to
db2_connect().
<?php
$conn = db2_connect('badname', 'baduser', 'badpassword');
if (!$conn) {
print db2_conn_errormsg();
}
?>
The above example will output:
[IBM][CLI Driver] SQL1013N The database alias name
or database name "BADNAME" could not be found. SQLSTATE=42705
SQLCODE=-1013