如何加载jQuery中添加的最新数据

时间:2018-08-23 07:46:38

标签: php

这是我的PHP脚本,我想加载在旧数据之前首先输入的最新数据。请帮助...

 /*call the contents from the founofficer*/
 if ($content=="foun"){
    $query=mysql_query("SELECT title,content FROM founofficer");
    $limit=mysql_num_rows($query);
    if ($limit==0){
        $disp.="No current foundation officers!";
    }
    else {
        for($j=1;$j<=$limit;$j++){
            $row=mysql_fetch_object($query);
            $disp.="<div id='hTitle'>".$row->title."</div>";
            $disp.="<div id='hContent'>".$row->content."</div>";
        }
    }
}

1 个答案:

答案 0 :(得分:1)

尝试更改查询

 $query=mysql_query("SELECT title,content FROM founofficer order by id asc"); //change as per your table column like id or srno etc and asc or desc as per your need...

还建议使用mysqli或PDO ...代替mysql