风之舞 - 芽雨快跑 - PHP MySQL Linux Apache 编程
require("head.php");
require("user_info.php");
?>
$sql="SELECT * FROM `inform` order by id desc limit 0,1";
$inform = $db->fetch_assoc($sql);
?>
$sql1="SELECT * FROM `category1` order by command";
$arrCate1 = $db->fetch_assoc($sql1);
$i=0;
foreach ($arrCate1 as $cate1)
{
?>
echo $cate1["name"]; ?>
$sql2="SELECT * FROM `category2` WHERE id_cate1=".$cate1["id"]." order by command";
$arrCate2 = $db->fetch_assoc($sql1);
foreach ($arrCate2 as $cate2)
{
//得到最后发表的信息,先对新主题帖子和新回复帖子的时间进行比较
$sql11="SELECT * FROM `article` WHERE id_cate2='".$cate2['id']."' order by id desc limit 1";
$article11 = $db->fetch_assoc_one($sql11);
$sql3="SELECT * FROM `rearticle` WHERE id_cate2='".$cate2['id']."' order by id desc limit 1";
$rearticle = $db->fetch_assoc_one($sql3);
if($article11["time1"]<$rearticle["time1"])
{
$sql4="SELECT * FROM `article` WHERE id='".$rearticle["id_article"]."'";
$article4 = $db->fetch_assoc_one($sql4);
//$title=substr($article["title"], 0,8);
$title=gbSubstr2($article4["title"]);
$writer=$rearticle["name_rewriter"];
$time=$rearticle["time1"];
$id=$rearticle["id_article"];
}
else
{
//$title=substr($article11["title"], 0,8);
$title=gbSubstr2($article11["title"]);
$writer=$article11["name_writer"];
$time=$article11["time1"];
$id=$article11["id"];
}
?>