0
正如標題是,我收到了「主題無法顯示,請稍後再試。」錯誤消息,但數據插入到我的MySQL表罰款,但我不明白爲什麼他們不顯示,這裏是我的結果頁面。MySQL的結果插入到數據庫中,但不顯示任何結果
<?php
include 'core/init.php';
include 'includes/overall/header.php';
$sql = "SELECT 'topic_id', 'topic_subject', 'category', 'sub_category', 'posted_by', 'posted', 'view', 'reply' FROM `topics`
WHERE topics.topic_id = " . mysql_real_escape_string($_GET['id']);
$result = mysql_query($sql);
if(!$result)
{
echo 'The topic could not be displayed, please try again later.';
}
else
{
if(mysql_num_rows($result) == 0)
{
echo 'This topic doesn′t exist.';
}
else
{
while($row = mysql_fetch_assoc($result))
{
$posts_sql = "SELECT 'posts.post_topic', 'posts.post_content', 'posts.post_date', 'posts.post_by',
'users.user_id', 'users.username', 'users.profile'
FROM
`posts`
LEFT JOIN
`users`
ON
posts.post_by = users.user_id
WHERE
posts.post_topic = " . mysql_real_escape_string($_GET['id']);
$posts_result = mysql_query($posts_sql);
if(!$posts_result)
{
echo '<tr><td>The posts could not be displayed, please try again later.</tr></td></table>';
}
else
{
while($posts_row = mysql_fetch_assoc($posts_result))
{
include("includes/results-template.php");
}
}
if(!$_SESSION['signed_in'])
{
echo '<tr><td colspan=2>You must be <a href="signin.php">signed in</a> to reply. You can also <a href="signup.php">sign up</a> for an account.';
}
else
{
//show reply box
echo '<tr><td colspan="2"><h2>Reply:</h2><br />
<form method="post" action="reply.php?id=' . $row['topic_id'] . '">
<textarea name="reply-content"></textarea><br /><br />
<input type="submit" value="Submit reply" />
</form></td></tr>';
}
//finish the table
echo '</table>';
}
}
}
?>
<?php include 'includes/overall/footer.php'; ?>