PHP mySQLi_fetch_all: iterate through each row

前端 未结 4 514
梦毁少年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 09:04

    You pseudo code is all fine.. you just need to turn it into PHP....

    Answer to first question:

    // Loop through each row and print it
    foreach( $rows as $row ):
       print_r( $row )
    endforeach;
    

    Second question.. something like:

    foreach( $rows as $row ):
       foreach( $row as $col ):
          echo $col;
       endforeach;    
    endforeach;
    

提交回复
热议问题