Home  >  Article  >  Backend Development  >  php通告栏有关问题

php通告栏有关问题

WBOY
WBOYOriginal
2016-06-13 10:15:22996browse

php通告栏问题







  include("../control/config.php");
$result=mysql_query("select * from NOTICE as n order by n.N_TIME desc limit 5 ");
while($rows=mysql_fetch_array($result))
{
echo "";
echo "";
echo "";
echo "";
echo "";
}
mysql_close($db);
?>
序号 通告标题 时间
";
echo $rows['N_ID'];
echo "
";
echo $rows['N_TITLE'];
echo "
";
echo $rows['N_TIME'];
echo "

当我点击网页上的主题(N_title)时,进入一个页面。显示主题内容什么的。
当点击一个主题时怎么自动生成一个新的界面显示?

------解决方案--------------------
新建个页面。把该条记录查询出来显示就是了。
------解决方案--------------------
echo "$rows[N_TITLE]";

view.php
include("../control/config.php");
$result=mysql_query("select * from NOTICE as n where N_ID=$_GET[id]");
$rows = mysql_fetch_array($result);
//输出 $rows 的代码
------解决方案--------------------
你的标题是从数据库读取的,那么在读取标题的,也读取文章id,附带在链接中传递

标题的链接是 view.php?id=
这样就可以给view.php页面传递一个文章的id参数。

这是view.php页面
if(empty($_GET['id']))
exit('没有指定文章id);
// 根据传入的id读取文章不就行了
$SQL = "SELECT * FROM `post` WHERE id=$_GET['id'] ";
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn