php sybase_fetch_array使用方法
返回數(shù)組資料。
語法: array sybase_fetch_array(int result);
返回值: 數(shù)組
函數(shù)種類: 數(shù)據(jù)庫功能
內容說明
本函數(shù)用來將查詢結果 result 拆到數(shù)組變量中。若 result 沒有資料,則返回 false 值。而本函數(shù)可以說是 sybase_fetch_row() 的加強函數(shù),除可以將返回列及數(shù)字索引放入數(shù)組之外,還可以將文字索引放入數(shù)組中。
使用范例
這是 joey@samaritan.com (22-Feb-1999) 所提出的例子
實例1:
<?php
$q = sybase_query("SELECT COUNT(DISTINCT OPPORTUNITY_ID) FROM M_OPP_INTERESTS WHERE INTEREST_ID = $i_id", $db);
while ($op_by_int = sybase_fetch_array($q)) {
while (list($k, $v) = each($op_by_int)) {
echo "\$op[$k] => $v\n";
}
?>
返回資料如下
$op[0] => 2164
$op[computed] => 2164
實例2:
<?php
$dbh = sybase_connect('SYBASE', '', '');
$q = sybase_query('SELECT * FROM p, a WHERE p.person_id= a.person_id');
var_dump(sybase_fetch_array($q));
sybase_close($dbh);
?>
The above example would produce the following output (assuming the two tables only have each one column called "person_id"):
array(4) {
[0]=>
int(1)
["person_id"]=>
int(1)
[1]=>
int(1)
["person_id1"]=>
int(1)
}
相關文章
利用php和js實現(xiàn)頁面數(shù)據(jù)刷新
利用php和js實現(xiàn)頁面數(shù)據(jù)刷新...2006-10-10
PHP convert_cyr_string()函數(shù)講解
今天小編就為大家分享一篇關于PHP convert_cyr_string()函數(shù)講解,小編覺得內容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧2019-02-02

