$con = mysql_connect("localhost","root","");//连接数据库
mysql_select_db("btxiazai",$con);//选择数据库
mysql_query("set names utf8");
$sql = "select * from persons order by id desc limit 2";//获取persons中的数据,并按id倒叙排列,取其中两条
$get = mysql_query($sql);//执行sql
while($result = mysql_fetch_assoc($get)){//取回数据
}