日期:2014-05-17 浏览次数:20618 次
<?php
if(!mysql_connect("localhost","admin","admin"))
die("Could not connect:".mysql_error());
mysql_select_db("cesf");
$query="SET NAMES 'GB2312'";
mysql_query($query);
?>
<?php
$keyword=$_POST['keyword'];
$contents= array();
$rt=mysql_query("select * from dede_archives where title like '%$keyword%'");
while ($rs=mysql_fetch_array($rt))
{
$contents[]=$rs;
}
?>
<html>
<head><title>查询实例</title></head>
<body>
<?php
foreach($contents as $key=>$value){
echo "<table border=\"1\" cellpadding=\"1\" cellspacing=\"0\" width=\"600\" style=\"border-collapse:collapse;\">";
echo "<tr><td>$value[title]</td></tr>";
echo "</table>";
}
?>
</body>
</html>