The following example demonstrates how to return an SQLSTATE value
after deliberately passing invalid parameters to
db2_connect().
<?php
$conn = db2_connect('badname', 'baduser', 'badpassword');
if (!$conn) {
print "SQLSTATE value: " . db2_conn_error();
}
?>
The above example will output:
SQLSTATE value: 08001