<html> <h2>Demo 4 - Displaying an Informix Error Message</h2> <?php /*********************************************************************/ function chk_ifx_err1($result_id) /*********************************************************************/ { /************************************************** The ifx_error function return the following string: x [SQLSTATE = aa bbb SQLCODE=cccc] where x = space : no error E : error N : no more data W : warning ? : undefined *************************************************/ $err_string = ifx_error($result_id); if ($err_string[0] != ' ') { printf("<BR>Informix error: %s", ifx_errormsg()); die; } } $database = "video"; $server = "lapdog_tcp"; $login = "username"; $password = "INVALID PASSWORD"; // Note: Password is deliberately invalid for this demo $dbs = $database . "@" . $server; $connect_id = ifx_pconnect($dbs,$login,$password); if (!$connect_id) { echo "Unable to connect to Informix database<br>\n"; chk_ifx_err1($connect_id); } else { echo "Informix connection successful! <BR>"; } ?> </html>