php如何将查询到的多条数据拼接成一个文本变量?

WBOY
Release: 2016-06-23 13:30:56
Original
1306 people have browsed it

如我通过一个sql一句查到3条数据,我现在想把这三条数据分行拼接成一个文本,然后赋值个一个变量,通过输出这个变量得到拼接好的文本,该如何做?


回复讨论(解决方案)

$res = '';while($row = mysql_fetch_assoc($rs)) {  $res .= $row['字段'];}echo $res;
Copy after login

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