<table border=1>
<?php
$conn = mysql_connect("localhost","root","");
mysql_select_db("art");
$sql = "select * from art order by id limit 0,10";
$rs = mysql_query($sql);
while($result = mysql_fetch_array($rs))
{
$title = $result['title'];
?>
<tr>
<td><?php echo $title;?></td>
</tr>
<?php } ?>
</table>代码是这样的,输出前十条,那么前三条后面加个代表"new"的图片,多谢了,请给个思想或者把上面的代码修改一下也可以
<?php
$conn = mysql_connect("localhost","root","");
mysql_select_db("art");
$sql = "select * from art order by id limit 0,10";
$rs = mysql_query($sql);
while($result = mysql_fetch_array($rs))
{
$title = $result['title'];
?>
<tr>
<td><?php echo $title;?></td>
</tr>
<?php } ?>
</table>代码是这样的,输出前十条,那么前三条后面加个代表"new"的图片,多谢了,请给个思想或者把上面的代码修改一下也可以
<?php
$conn = mysql_connect("localhost","root","");
mysql_select_db("art");
$sql = "select * from art order by id limit 0,10";
$rs = mysql_query($sql);
$i = 0;
while($result = mysql_fetch_array($rs))
{
$title = $result['title'];
?>
<tr>
<td><?php if($<3){ echo "新新闻图片...."; } echo $title;?></td>
</tr>
<?php $i++; } ?>
</table>
<?php
$conn = mysql_connect("localhost","root","");
mysql_select_db("art");
$sql = "select * from art order by id limit 0,10";
$rs = mysql_query($sql);
$i = 0;
while($result = mysql_fetch_array($rs))
{
$title = $result['title'];
?>
<tr>
<td><?php if($i<3){ echo "新新闻图片...."; } echo $title;?></td>
</tr>
<?php $i++; } ?>
</table>