Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Anonymous
Anonymous asked in 電腦與網際網路程式設計 · 2 decades ago

mysql資料庫語法....

請問mysql_fetch_array( ) 與 mysql_fetch_assoc( ) 有什麼差別?

查看dreamweaver寫的語法都是使用mysql_fetch_assoc( ) 來寫滴.

兩種寫法可互換嗎?

3Q

2 Answers

Rating
  • 2 decades ago
    Favorite Answer

    原則上兩個指令功能是一樣的,

    而mysql_fetch_array語法如下:

    mysql_fetch_array(resource, int(result_type));

    而result_type有下列三種:

    MYSQL_ASSOC:associative array,

    MYSQL_NUM:enumerated array,

    MYSQL_BOTH:associative array與enumerated array,

    mysql_fetch_array($result);==mysql_fetch_assoc($result);

    mysql_fetch_array($result,MYSQL_ASSOC);==mysql_fetch_assoc($result);

    提取資料可用資料庫的欄位名稱。

    mysql_fetch_array($result,MYSQL_NUM);

    提取資料可用數字。

    我都習慣用mysql_fetch_row。

    Source(s): 自己
  • 2 decades ago

    mysql_fetch_assocFetch a result row as an associative array 截取陣列最後的結果!!mysql_fetch_array( ) 傳回陣列資料

Still have questions? Get your answers by asking now.