我正在尝试按照本教程https://www.youtube.com/watch?v=kebwxI1Bw88创建论坛。我已经成功地跟着它,直到这一点,但出于某种原因 用户在某个主题中创建论坛帖子的链接无法正常工作。任何人都可以看到我的代码有任何问题或发现任何原因,为什么这不起作用。我无法看到我的代码有任何问题,我已按照教程的说法进行了操作。
该链接位于第一个if语句中。
该链接应显示在此页面上,并且尚未创建文件create_topic.php。
<?php session_start();?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Forum</title>
<link href="styles.css" rel="stylesheet" type="text/css">
<script>var __adobewebfontsappname__="dreamweaver"</script>
<script src="http://use.edgefonts.net/source-sans-pro:n6:default.js" type="text/javascript"></script>
</head>
<body>
<div id="wrapper">
<header id="top">
<h1>ITSize</h1>
<nav id="mainnav">
<ul>
<li><a href="Index.php">Home</a></li>
<li><a href="Fourth Page.html">Register</a></li>
<li><a href="Second Page.html">Revise</a></li>
<li><a href="Forum.php">Forum</a></li>
</ul>
</nav>
</header>
<article id="main">
<br>
<br>
<?php
include_once("DBconnect.php");
$cid= $_GET['cid'];
if (isset($_SESSION['uid'])){
$logged= " | <a href='create_topic.php?cid=".$cid."'>Click here to create a topic</a>";
}else{
$logged = " | Please log in to create topics in this forum";
}
$sql = "SELECT id FROM categories WHERE id='".$cid."' LIMIT 1";
$res = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($res) ==1){
$sql2 = "SELECT * FROM topics WHERE category_id='".$cid."' ORDER BY topic_reply_date DESC";
$res2 = mysql_query($sql2) or die(mysql_error());
if (mysql_num_rows($res2)>0){
$topics .= "<table width='100%' style='border-collapse: collapse;'>";
$topics .= "<tr><td colspan='3'<a href='Forum.php'>Return To Forum</a>".$logged."</td></tr>";
$topics .= "<tr style='background-colour: #dddddd;'><td>Topic Title</td><td width='65' align='center'>Replies</td><td width='65' align='center'>Views</td</tr>";
while ($row = mysql_fetch_assoc($res2)){
$tid = $row['id'];
$title = $row['topic_title'];
$views = $row['topic_views'];
$date = $row['topic_date'];
$creator =$row['topic_creator'];
$topics .= "<tr><td><a href='view_topic.php?cid=".$cid."&tid=".$tid.">".$title."</a><spa class='post_info'>Posted by:".$creator." on ".$date."</span></td><td align='center'>0</td><td align='center'>".$views."</td></tr>";
$topics .="<tr><td colspan='3'></td></tr>";
}
$topics .="</table>";
}else{
echo"<p> There are no topics in this category yet</p><br>";
echo "<a href='Forum.php'>Return To Forum Page</a><br><br>";
}
}
else{
echo"<p> You are trying to view a category that does not exist</p><br>";
echo "<a href='Forum.php'>Return To Forum Page</a><br><br>";
}
?>
</article>
<aside id="sidebar">
</aside>
<footer><a href="Third Page.html">My Account</a>
</footer>
</div>
</body>
</html>