dpd66100
dpd66100
2014-10-01 21:39

将MySQL查询转换为多维数组

  • php
  • mysql
  • arrays

I'm having trouble tackling this one. I have a set of data that is returned from a MySQL query like this:

url | users
https://www.facebook.com/ | patrick
https://www.google.com/ | patrick
https://www.reddit.com/ | bob
https://www.bing.com/ | bob
https://www.yahoo.com/ | bertha

where '|' is the field separator.

I need to parse this data using PHP to form a multidimensional array that looks like this:

patrick
   https://www.facebook.com/
   https://www.google.com/
bob
   https://www.reddit.com/
   https://www.bing.com/
bertha
   https://www.yahoo.com/

Any assistance would be appreciated.

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答