一,调取最新列表
lfwa.zrghs.com/*
$articleList=array(array(articleid=>'1',title=>'文章1'),array(articleid=>'2',title=>'文章1'));
foreach($articleList as $article){
echo ''.$article['title'].'
';
}*/
$conn = new mysqli("localhost", "root", "root", "gszy.zrghs.com");
$list = $conn->query("select article_id,title,djs from article order by createtime desc limit 3");
while($row = $list->fetch_assoc()) {
echo "
".$row['title']." ".$row['djs']."";}
?>
二内容显示
$articleid=$_GET['id'];
$conn = new mysqli("localhost", "root", "root", "czdg.zrghs.com");
$result = $conn->query("select * from article where article_id=".$articleid);
$sql="update article set djs=djs+1 where article_id=".$articleid;
if ($result->num_rows > 0) {
// 输出数据
while($row = $result->fetch_assoc()) {
echo $row["content"];
}
} else {
echo "0 结果";
}
$conn->query($sql);
$conn->close();
?>