php sybase_fetch_array使用方法
返回?cái)?shù)組資料。
語法: array sybase_fetch_array(int result);
返回值: 數(shù)組
函數(shù)種類: 數(shù)據(jù)庫功能
內(nèi)容說明
本函數(shù)用來將查詢結(jié)果 result 拆到數(shù)組變量中。若 result 沒有資料,則返回 false 值。而本函數(shù)可以說是 sybase_fetch_row() 的加強(qiáng)函數(shù),除可以將返回列及數(shù)字索引放入數(shù)組之外,還可以將文字索引放入數(shù)組中。
使用范例
這是 joey@samaritan.com (22-Feb-1999) 所提出的例子
實(shí)例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
實(shí)例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)
}
相關(guān)文章
PHP5權(quán)威編程閱讀學(xué)習(xí)筆記 附電子書下載
PHP5中,使用新的統(tǒng)一的構(gòu)造函數(shù)命名方式:__construct(),當(dāng)然,使用類名同樣也是可以的2012-07-07
利用php和js實(shí)現(xiàn)頁面數(shù)據(jù)刷新
利用php和js實(shí)現(xiàn)頁面數(shù)據(jù)刷新...2006-10-10
php auth_http類庫進(jìn)行身份效驗(yàn)
前提是要安裝auth類庫和auth_http類庫2009-03-03
PHP convert_cyr_string()函數(shù)講解
今天小編就為大家分享一篇關(guān)于PHP convert_cyr_string()函數(shù)講解,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧2019-02-02

