Demo 7 - Select rows using a cursor
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
\n";
chk_ifx_err1($connect_id);
} else {
echo "Informix connection successful!
";
}
if ($connect_id) {
$statmt_txt = "select first 5 * 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); }
echo "";
echo "";
echo "Serial ID | ";
echo "Type Code | ";
echo "Tape Number | ";
echo "Title | ";
echo "Hours | ";
echo "Comment | ";
echo "Modify | ";
echo "
\n";
while ($row = ifx_fetch_row($statmt_id,"NEXT")) {
$serial_id = $row[serial_id];
$type_code = chop($row[type_code]);
$tape_num = $row[tape_num];
$title = chop($row[title]);
$hours = $row[hours];
$comment = chop($row[comment]);
echo "\n";
echo "$serial_id | ";
echo "$type_code | ";
echo "$tape_num | ";
echo "$title | ";
echo "$hours | ";
echo "$comment | ";
echo "
\n";
}
echo "
";
}
?>