我在这里需要认真的帮助!我正在建设这个网站:每篇文章的摘要都是从数据库中生成的,标题为链接,但我希望如果有人点击链接,文章的页面会自动生成而不会匆忙;因为我无法为数据库中的每篇文章编写一个页面!这是我生成摘要的代码:
<?php
if(isset($_POST['search'])){
$term = mysql_real_escape_string($_POST['keyword']);
$search = mysql_query("select * from article
where match(title, body) against('$term') ");
if(mysql_num_rows($search)>0){
echo "<div>"."Search Results For: "."<h3><u>".$term."</u></h3>"."</div>";
while($result = mysql_fetch_array($search)){
echo "<div class=\"article\">".
"<div class=\"title\"><a href=\"".$result['cat'].".php"."\">".$result['title']."</a></div>".
"<div class=\"body\">".substr($result['body'], 0, 250)."</div>".
"<div class=\"cat\"><a href=\"".$result['cat'].".php"."\">"."Category: ".$result['cat']."</a></div>".
"<div class=\"author\">"."Author: ".$result['author']."</div>".
"<div class=\"dateTime\">"."Date: ".$result['date']."</div>".
"</div>";
}
}
else{
echo "Sorry! The search for "."<h3>".$term."</h3>"." gave no results.";
}
}
?>