作者 lee [actionscript] 2007-09-09 14:34 (点击下载)

  1. <?php
  2. session_start() ;
  3. require_once 'echoHTML.php';
  4. $linkCSS = NULL ;
  5. $headTitle = ' 帖子列表 ' ;
  6. $headMeta = NULL ;
  7. $absPath = NULL ;
  8. HTMLHead($linkCSS, $headTitle, $headMeta, $absPath ) ;
  9.  
  10. if ( !isset($_SESSION['user_id']) ) {
  11. echo ' Please <a href="login.php">login</a> first ' ;
  12. HTMLTail();
  13. exit;
  14. }
  15.  
  16. require_once 'connectDB.php' ;
  17. connectDB() ;
  18. $query = " SELECT * FROM users NATURAL JOIN posts NATURAL JOIN categories ORDER BY posted DESC ";
  19.  
  20. $result = mysql_query($query) or die(mysql_error());
  21. echo "<table border='1'>" ;
  22. echo "
  23. <tr>
  24. <th>Category</th>
  25. <th>Title</th>
  26. <th>Username</th>
  27. <th>Posted</th>
  28. </tr>
  29. ";
  30. while ($row=mysql_fetch_array($result, MYSQL_ASSOC)) {
  31. $category = $row["category"] ;
  32. $title = $row ["title"] ;
  33. $username = $row["username"] ;
  34. $posted = $row["posted"] ;
  35. $post_id = $row["post_id"] ;
  36.  
  37. echo "<tr>";
  38. echo "<td>$category</td>";
  39. echo "<td>$title</td>";
  40. echo "<td>$username</td>";
  41. echo "<td>$posted</td>";
  42.  
  43. echo '<td><a href="viewPost.php?post_id='.$post_id.'">View</a></td>';
  44. echo '<td><a href="removePost.php?post_id='.$post_id.'">Remove</a></td>';
  45. echo '<td><a href="editPost.php?post_id='.$post_id.'">Edit</a></td>' ;
  46. echo "</tr>";
  47. }
  48. echo "</table>" ;
  49.  
  50. echo ' <p> <a href="post.php">Add post</a> </p> ' ;
  51.  
  52. HTMLTail();
  53.  
  54. ?>

提交下面的校正或者修改. (点击这里开始一个新的帖子)
姓名: 在 cookie 中记住我的名字

屏幕抓图:(jpeg 或 png)