Home > Backend Development > PHP Tutorial > php后台查出数据,输出在html表格里,如何做

php后台查出数据,输出在html表格里,如何做

WBOY
Release: 2016-06-13 12:06:49
Original
1365 people have browsed it

php后台查出数据,输出在html表格里,怎么做
php后台查出数据,输出在html表格里。后台b.php,前台a.html。查出的数据是$result,里面有id,name。怎么做?
------解决思路----------------------
b.php:

<br />$con=mysqli_connect('localhost','root','root','test');  //用户名和密码请自己修改<br />$a=mysqli_query($con,'select * from a');                  //表名自己修改<br />$html="<table border='1' width='100'><tr><td>id</td><td>name</td></tr>";<br />while($rel=mysqli_fetch_assoc($a)){<br />    $html=$html."<tr><td>{$rel['id']}</td><td>{$rel['name']}</td></tr>";<br />}<br />$html.'</table>';<br />file_put_contents('a.html',$html);<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