PHP mySQLi_fetch_all: iterate through each row

前端 未结 4 530
梦毁少年i
梦毁少年i 2020-12-20 08:19

I am retrieving the rows of my query as such:

$rows = mysqli_fetch_all($result, MYSQLI_ASSOC);

How can I do:

(PSEUDO CODE)
         


        
4条回答
  •  抹茶落季
    2020-12-20 08:45

    $rows = mysqli_fetch_assoc($result, MYSQLI_ASSOC);
    

    Use the mysqli_fetch_assoc function.

    And the use the foreach as:

    foreach($rows as $column => $value) {
      echo $column." = ".$value;
    }
    

    Note: You can also use foreach with mysqli_fetch_all.

提交回复
热议问题