【www.gdgbn.com--word】
首先我们来创建搜索数据表
create table if not exists `search` (
`id` int(4) not null auto_increment,
`keyword` varchar(500) not null,
primary key (`id`)
) engine=myisam default charset=utf8 auto_increment=1 ;
保存数据
代码如下 insert into `acc`.`search` (`id` ,
`keyword`
)
values (
null , "内容搜索"
), (
null , "php站内搜索"
);
*/
//数据连接
代码如下$conn = mysql教程_connect("localhost","ac","1");//这里的ac用户名,1是密码,修改成你自己的mysql便可
$res = mysql_db_query("abc","select * from search where keyword="内容搜索" ") or die(mysql_error());
if(mysql_num_rows($res) == 1) {
while($row = mysql_fetch_assoc($res)) {
foreach($row as $key => $val) {
echo $row["keyword"],"
";
}
}
}
/*
本站原创转载注明来源www.111cn.net
*/