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 资料表 : %s\n<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); // 之后程式省略 ?>
|