success.php

代码
<?php
session_start();
if($_SESSION["issession"]!=true)
{
echo "<a href=login.php>重新登录</a>";
exit;

}
$link = mysql_connect("localhost:3306","student","123456");
mysql_select_db('test');
$query = "select * from tieba";
?>
<html>
<head>
<title>程序员贴吧</title>
<style type="text/css">
<!--
.title{
    color
:#FFF;
    background-color:#06F;
    text-align:center;
}
.td{
    background
-color:#ccc;
}
-->
</style>

<body>
<div align="center">
 
<table width="603" border="1">
 
<tr class="title">
    
<td width="39">姓名</td>
    
<td width="441">标题</td>
     
<td width="441">内容</td>
    
<td width="101">时间</td>
</tr> 
<?php
$result = mysql_query($query);
$row=mysql_num_rows($result);
if($row>0)


    
$i=0;
    
while($row=mysql_fetch_array($result,MYSQL_ASSOC))
         {
    
if($i==0)
         {
    
echo "<tr class=\"td\">";
    
$i++;
    }
    
else
    {
echo "<tr>";
    
$i=0;
    }
    
?>
         
<td><?=$row["tname"]?></td>
         
<td><?=$row["ttitle"]?></td>

          
<td><?=$row["tword"]?></td>
        
<td><?=$row["ttime"]?></td>

<?php
        }
}
else
{
echo "数据库中没有数据";
}
echo "<a href=fatie.php>发帖</a>";
mysql_close();
?>
</table>
</div>
</body>
</html>


posted @ 2010-11-06 11:12  xiao.ji  阅读(224)  评论(0编辑  收藏  举报