How to load MySQLi result set into two-dimensional array?

后端 未结 3 921
囚心锁ツ
囚心锁ツ 2021-01-13 08:54

I\'ve got a problem with the mysqli result set. I have a table that contains a bunch of messages. Every table row represents one message. I have a few columns like ID, title

3条回答
  •  青春惊慌失措
    2021-01-13 09:24

    How your final array must look like?

    Try this:

    $result = $link->query("SELECT title, body FROM messages WHERE public = '1'");
    $array = array();
    while ($array[] = mysql_fetch_assoc($result)) {}
    

提交回复
热议问题