PHP完全中文操作手冊

天地JPLOP | PHP首頁 | 函數索引
函數:ifx_query()

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);
// 之後程序省略
?>



整理: 夕垌菪姬 (天地JPLOP)
[ 上一頁 回主目錄 下一頁 ]
版權所有,天地JPLOP、爵堤亞(夕垌菪姬)。網頁背景音樂和各鍊結標題
及鍊結內容和文章小說,版面編排皆歸原權利人所有對本版面
有任何意見或指教,歡迎至論壇指教。