Displaying an associative array in PHP

前端 未结 6 1963
南旧
南旧 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:50

    Assuming you've made the call, and got $result back:

    $array = new array();
    while($row = mysql_fetch_assoc($result)){
      $array[] = $row;
    }
    return $array;
    

提交回复
热议问题