Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be 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.

匿名
Lv 7
匿名 asked in 電腦與網際網路程式設計 · 2 decades ago

以下的一句php程式是什麼意思?

以下的一句php程式是什麼意思?list($db_password,$power) = mysql_fetch_row($list);請大大詳細地解釋一下。

1 Answer

Rating
  • 2 decades ago
    Favorite Answer

    list是列出陣列元素

    用法如下

    $result = mysql($conn, "SELECT id, name, salary FROM employees");

    list($id, $name, $salary) = mysql_fetch_row($result)

    架設資料庫理有以下資料

    filed1 filed2 filed3 <-- 資料庫欄位

    00 11 22

    33 44 55

    $result = mysql($conn, "SELECT * FROM tables");

    list($filed1, $filed2, $filed3) = mysql_fetch_row($result)

    他會依序將資料庫裡的filed1 的資料放在$filed1

    filed2 放在 $filed2

    filed3 放在 $filed3

    假如我們在改成下面方式

    $result = mysql($conn, "SELECT * FROM tables");

    list($filed7, $filed3, ) = mysql_fetch_row($result)

    他會依序將資料庫裡的filed1 的資料放在$filed7

    filed2 放在 $filed3

    filed3 欄位的資料則並沒有放到變數中

Still have questions? Get your answers by asking now.