Home >Backend Development >PHP Tutorial >数组输出问题

数组输出问题

WBOY
WBOYOriginal
2016-06-23 13:33:11948browse


数据结构如上
用select  * from table limit 1
while($row=mysql_fetch_array($resutl)){
foreach($row as $key=>$val){

echo "$key => $val 
";

}


}


输出结构与表不一样,因为数据结构列的数量和字段名不固定,不能指定下标,请问下各位要怎么输出才可以达到跟表格式一致,谢谢了!!


回复讨论(解决方案)

mysql_fetch_array 改为 mysql_fetch_assoc

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