Get rows from mysql table to php arrays

前端 未结 5 2047
借酒劲吻你
借酒劲吻你 2021-02-04 10:10

How can i get every row of a mysql table and put it in a php array? Do i need a multidimensional array for this? The purpose of all this is to display some points on a google ma

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-04 10:33

    You can do it without a loop. Just use the fetch_all command

    $sql     = 'SELECT someFieldName FROM yourTableName';
    $result  = $db->query($sql);
    $allRows = $result->fetch_all();
    

提交回复
热议问题