mysql_fetch_array add all rows?

后端 未结 2 1119
花落未央
花落未央 2020-12-03 20:25

How can you add all the rows from a mysql_query to a mysql_fetch_array()? I want to be able to do it as efficiently as possible as it could be working with quite a few rows.

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-03 20:43

    The most common way:

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

    as shown in the examples in the documentation.

提交回复
热议问题