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

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

WBOY
WBOYOriginal
2016-06-13 12:06:491256browse

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


$con=mysqli_connect('localhost','root','root','test'); //用户名和密码请自己修改
$a=mysqli_query($con,'select * from a'); //表名自己修改
$html="";
while($rel=mysqli_fetch_assoc($a)){
$html=$html."";
}
$html.'
idname
{$rel['id']}{$rel['name']}
';
file_put_contents('a.html',$html);


------解决思路----------------------
请使用模板技术

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