php sybase_fetch_array使用方法_PHP教程

來源:互聯網
上載者:User
返回數組資料。
文法: 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($q)) {
while (list($k, $v) = each($op_by_int)) {
echo "\$op[$k] => $v\n";
}
?>

返回資料如下

$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"]=>
int(1)
}

http://www.bkjia.com/PHPjc/754796.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/754796.htmlTechArticle返回數組資料。 文法: array sybase_fetch_array(int result); 傳回值: 數組 函數種類: 資料庫功能 內容說明 本函數用來將查詢結果 result 拆到數組變...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.