$_keywords = $_GET['q'];
$key = explode(' ', $_keywords );
if ( sizeof( $key ) == 1 ) {
$where = " title like '%{$_keywords}%' ";
} else {
froeach( $key as $word ) {
$k[] = " title like '%{$word}%' ";
}
$where = join(' or ', $k );
}
$sql = "select * from news where status = 1 and ({$where}) and catid = 23 order by id desc";
php查询数据库内容
$content = '电脑店 联想';
$Key = explode(' ', $content); //打散成数组
foreach( $key as $k => $val ) {
$Like .= !$k ? " 关键词 like '%{$val}%' " : " or 关键词 like '&{$val}&' ";
}
$Sql = "select * from 表 wehre {$Like}";
//查询sql自己写
- 上一篇: 想知道有没有什么软件知道淘宝热搜词?
- 下一篇: 百度推广的关键词平均排名最高值是多少啊