PHP MySQLi echo data in array without doing a while loop

前端 未结 1 1119
我寻月下人不归
我寻月下人不归 2021-01-14 09:20

When using MySQLi, do I have to perform a kind of while loop where the actual data from the query is put into a variable array?

$conn = new          


        
1条回答
  •  逝去的感伤
    2021-01-14 10:07

    If there is only one row, you don't need the loop. Just do:

    $row = $rs->fetch_assoc();
    $name = $row['name'];
    

    0 讨论(0)
提交回复
热议问题