Home  >  Article  >  Backend Development  >  php数组的格式输出有关问题,请问大神

php数组的格式输出有关问题,请问大神

WBOY
WBOYOriginal
2016-06-13 12:26:46806browse

php数组的格式输出问题,请教大神
我有以下这样一个表


请问,我要怎样才能让他根据 type类型和typeid来输出下面这个数组格式?谢谢

<br />Array(  <br />[0] => array(<br />            [0]=><br />            [1]=>婚庆服务<br />            [2]=>机械设备<br />            [3]=>医院医疗<br />            [4]=>照明灯饰<br />            [5]=>教育培训<br />            [6]=>化工涂料<br />            [7]=>美容健身<br />            [8]=>餐饮美食<br />            [9]=>汽车服务<br />            )<br />[1] => array(<br />            [0]=><br />            [1]=>常规<br />            [2]=>两列<br />            [3]=>三列<br />            [4]=>网格<br />            )<br />)<br />


------解决思路----------------------
查询后读取
while($row = mysql_fetch_assoc($rs)) {<br />  $res[$row['type'][] = $row['typevalue'];<br />}<br />$res = array_values($row);

------解决思路----------------------
我的错!
$res = array_values($res);

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