在PHP文件中如何用echo打印出while循环中的html语句……
我要循环输出一段语句,这个语句比较奇葩。要按照表格来输出,但每个格子中要从数据库提取数据,并再按照表格填入到外面的格子中……于是我就乱了套了……<?phpinclude(...
我要循环输出一段语句,这个语句比较奇葩。
要按照表格来输出,但每个格子中要从数据库提取数据,并再按照表格填入到外面的格子中……于是我就乱了套了……
<?php
include("head.php");
echo"<table align='center' border=1 width=600>";
for($ou=0;$ou<4;$ou++){
echo"<tr align='center' >";
for($it=0;$it<4;$it++){
echo
"<td>"
$result=mysql_query("select * from article order by id desc");"."while($row = mysql_fetch_object($result)){".
"echo'"<table width='1000' border='0'>"'."<tr>"."<td>"."<a href='$row->foldername'>".mb_substr($row->title,0,35,'utf-8')."</a>"."<br>".
"<div class='divcss5' align='center'>"."<img src=\"$row->foldername\">"."</img>"."</div>"."<br>".
$row->foldername."<br>"."作者:".$row->username."<br>"."发布于:".$row->date."<br>".mb_substr($row->content,0,50,'utf-8')." . . ."."</td>"."</tr>"."</table>"."<br>";
}.
"</td>";
}
echo"</tr>";
}
echo"</table>";
?> 展开
要按照表格来输出,但每个格子中要从数据库提取数据,并再按照表格填入到外面的格子中……于是我就乱了套了……
<?php
include("head.php");
echo"<table align='center' border=1 width=600>";
for($ou=0;$ou<4;$ou++){
echo"<tr align='center' >";
for($it=0;$it<4;$it++){
echo
"<td>"
$result=mysql_query("select * from article order by id desc");"."while($row = mysql_fetch_object($result)){".
"echo'"<table width='1000' border='0'>"'."<tr>"."<td>"."<a href='$row->foldername'>".mb_substr($row->title,0,35,'utf-8')."</a>"."<br>".
"<div class='divcss5' align='center'>"."<img src=\"$row->foldername\">"."</img>"."</div>"."<br>".
$row->foldername."<br>"."作者:".$row->username."<br>"."发布于:".$row->date."<br>".mb_substr($row->content,0,50,'utf-8')." . . ."."</td>"."</tr>"."</table>"."<br>";
}.
"</td>";
}
echo"</tr>";
}
echo"</table>";
?> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询