Home > Backend Development > PHP Tutorial > discuz x2.5中数据库读异常,求大侠指点

discuz x2.5中数据库读异常,求大侠指点

WBOY
Release: 2016-06-13 12:08:58
Original
906 people have browsed it

discuz x2.5中数据库读错误,求大侠指点!
source\module\bargai中bargai_indexphp中代码为:
$sql_store = 'SELECT cate_name FROM ecm_scategory ORDER BY sort_order';
$my_category= implode(' ',DB::fetch_all($sql_store));

template\default\bargai中bargai_index.html中代码为:







可在IE中的显示却为:
Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array?
为何不能输出cate_name中的数据——商品名称呢?


------解决思路----------------------
implode 只能将一维数组连接成串
你的 DB::fetch_all 显然返回的是二维数组
要写作这样

$my_category = implode(' ', array_map('implode', DB::fetch_all($sql_store)));
Copy after login

------解决思路----------------------
foreach(DB::fetch_all($sql_store) as $row) {<br />  echo $row['cate_name'] . '<br>';<br />}
Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template