Home > Backend Development > PHP Tutorial > 怎么将从数据库取得的数据循环写入5个dl

怎么将从数据库取得的数据循环写入5个dl

WBOY
Release: 2016-06-13 10:14:30
Original
1151 people have browsed it

如何将从数据库取得的数据循环写入5个dl
第一遍循环完成后再回到第一个dl往里面追加数据。

------解决方案--------------------
// 如数据库取得的数据
$arr = array(
0 => array(
'name' => '张三',
'job' => 'php程序员',
),
1 => array(
'name' => '李四',
'job' => '网页设计师',
),
2 => array(
'name' => '王五',
'job' => 'web开发工程师',
),
);

$dlstr = '';
foreach ($arr as $k => $v)
{
$dlstr .= "

{$v['name']},{$v['job']}
";
}

echo $dlstr;
?>
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