傳回數組資料。
語法: array sybase_fetch_array(int result);
傳回值: 陣列
函數種類: 資料庫功能
內容說明
本函數用來將查詢結果 result 拆到陣列變數中。若 result 沒有資料,則傳回 false 值。而本函數可以說是 sybase_fetch_row() 的加強函數,除可以將回傳列及數字索引放入陣列之外,還可以將文字索引放入陣列中。
使用範例
這是 joey@samaritan.com (22-Feb-1999) 所提出的範例
實例1:
$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($list , $v) = each($op_by_int)) {
echo "\$op[$k] => $v\n";
}
?>
P>
回傳資料如下
$op[0] => 2164
$op[computed] => 2164
實例2:
$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"]gtphpcn
int(1)
["person_id1"]gtphpcn
int(1)
["person_id1"]gtphpcn
int(1)
["person_id1"]gtphpcn
int(1)
["person_id1"]gtphpcn >
int(1)
}