<html> <h2>Demo 6 - Select rows</H2> <h2>Output to an HTML table</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 = "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><BR>"; } if ($connect_id) { $statmt_txt = "select first 5 tape_num Tape_number, title from vhs where type_code = 'ST1' order by title"; $statmt_id = ifx_prepare($statmt_txt,$connect_id,IFX_SCROLL); // PREPARE SELECT if (!$statmt_id) { chk_ifx_err1($statmt_id); } $ret_val = ifx_do($statmt_id); // EXECUTE PREPARED STATEMENT if (!$ret_val) { chk_ifx_err1($statmt_id); } ifx_htmltbl_result ($statmt_id, "BORDER='1' CELLSPACING=0 CELLPADDING=2 BGCOLOR='cornsilk' "); } ?> </html>