Displaying an associative array in PHP

前端 未结 6 1858
南旧
南旧 2021-01-23 04:20

I am trying to build a function that extracts information from a database and inserts it into an associative array in PHP using mysql_fetch_assoc, and return the ar

6条回答
  •  臣服心动
    2021-01-23 04:35

    while ($row = mysql_fetch_assoc($result)) {
        foreach ($row as $column => $value) {
            //Column name is in $column, value in $value
            //do displaying here
        }
    }
    

    If this is a new program, consider using the mysqli extension instead.

提交回复
热议问题