如何在单个文件中显示帖子;article.php?id=“;在另一个文件中单击链接后


how to display posts in a single file like "article.php?id=" after link clicked in another file

我有一个显示文章标题的文件,我希望文章的内容显示在一个单独的php文件中,比如"article.php?id="

在显示标题的页面上,将使用<a href='article.php?id={$id}'>包装标题。请记住,$id对于每个标题都应该是唯一的。单击锚点应该会将用户带到article.php,在页面上,从url中获取id,并在数据库中查询文章。例如

//Get the id first
$id = mysql_real_escape_string($_GET['id']);
//Then query your database for the article
$result = mysql_query("SELECT article FROM article_tbl WHERE id = '$id'");

希望这能有所帮助。