Home  >  Article  >  Backend Development  >  mysql to json的有关问题

mysql to json的有关问题

WBOY
WBOYOriginal
2016-06-13 12:40:14776browse

mysql to json的问题
我想生成嵌套的json的格式不知道怎么做。。。
比方说我要查询用户=aa的数据,可能不止一行:$row=mysql_fetch_array($rs);
结果可能是多行的: {{id=1,account=123,depart=xxx},{id=22,account=323,depart=kkk}}
我希望生成这样的json格式:
{user:aa,[{id=1,account=123,depart=xxx},{id=22,account=323,depart=kkk}]}应该怎么做?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn