下面是代码,每次上传新的数据后都出现在网页最下面,如何让php从最后一行开始读取,求教
<?php
@mysql_connect("localhost","root","root")
or die("数据库服务器连接失败!");
@mysql_select_db("id2057017_vt")
or die("数据库不存在或不可用!");
$query=@mysql_query("select * from upimage")
or die("SQL语句执行失败");
echo "<br/><br/>";
echo "<table border=1>";
while($row = mysql_fetch_row($query))
{
$images=$row[0];$intr=$row[1];$link=$row[2];$prcfik=$row[3];$name=$row[4];$upname=$row[5];$time=$row[6];$download=$row[7];
echo "<div class='las'>";
echo "<div class='lase'><img src='$images' height='120px' width='120px' ></div>" ;
echo "<div class='lasd'>$prcfik$name</div>";
echo "<div class='lasc'>上传者: $upname</div> ";
echo "<div class='link'>下载地址:<a href='http://$link' target='_blank' >$link</a>下载次数:$download</div>";
echo "<div class='time'>上传时间:$time</div>";
echo "</div>";
}
echo "</table>";
?>
$query = "select * from userlist where username = '$lune' ORDER BY id DESC LIMIT 1";
$result = mysqli_query($link, $query);
$row = mysqli_fetch_array($result);
echo $row['gangwei'];
最简单的方式,既然有ID,直接通过ID排序,取一条即可.