<html> <h2>Demo 3 - Connecting to an Informix Database</H2> <?php $database = "video"; $server = "lapdog_tcp"; $login = "username"; $password = "password"; $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>"; } /*********************************************************************/ 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] == ' ') return; printf("<BR>Informix error: %s<BR><BR>\n%s<BR>\n", ifx_error($result_id), ifx_errormsg()); die; } ?> </html>