How do I store all results from an SQL query in a multidimensional array?

后端 未结 5 1304
心在旅途
心在旅途 2021-02-08 17:46

hello every one i want to convert my array into other array type , plz help me out . I m using this

$row = mysql_fetch_array($result, MYSQL_ASSOC); 
5条回答
  •  南方客
    南方客 (楼主)
    2021-02-08 18:15

    $row = array();
    $row[] = mysql_fetch_array($result, MYSQL_ASSOC);
    

    Normally you'd assign the results like this in a loop

    $rows = array();
    while ($result = mysql_fetch_array($result, MYSQL_ASSOC)) {       
        $rows[] = $result;
    }
    

提交回复
热议问题