ifx_query
送出一个 query 字符串。
语法: int ifx_query(string query, int [link_identifier], int [cursor_type], mixed [blobidarray]);
返回值: 整数
函数种类: 数据库功能
内容说明
本函数送出 query 字符串供 Informix 做相关的处理步骤。若没有指定 link_identifier 参数,则程序会自动寻找最近打开的 ID。参数 cursor_type 可省略,其值有 IFX_SCROLL 与 IFX_HOLD 二种。若有 BLOB 的字段要加在 query 指令之中,可使用 blobidarray 参数,指定 BLOB 的代码。
使用范例
例一:
?php
// 之前的程序省略
ifx_textasvarchar(1); // 使用文字模式 (text mode) 的 blobs
$res_id = ifx_query("select * from orders", $conn_id);
if (! $res_id) {
printf("无法取出 orders 资料表 : %sn br %s br n", ifx_error());
ifx_errormsg();
die;
}
ifx_htmltbl_result($res_id, "border="1"");
ifx_free_result($res_id);
// 之后的程序省略
?
例二:
?php
// 之前的程序省略
//
// 为二进位及文字建立 BLOB 代码
$textid = ifx_create_blob(0, 0, "Text column in memory");
$byteid = ifx_create_blob(1, 0, "Byte column in memory");
$blobidarray[] = $textid;
$blobidarray[] = $byteid;
$query = "insert into catalog (stock_num, manu_code, " ."cat_descr,cat_picture) values(1,'HRO',?,?)";
$res_id = ifx_query($query, $conn_id, $blobidarray);
if (! $res_id) {
// 错误处理
}
ifx_free_result($res_id);
// 之后程序省略
?



