gpt4 book ai didi

php - 我试图让这段代码进行多个关键字搜索

转载 作者:行者123 更新时间:2023-11-30 00:15:39 24 4
gpt4 key购买 nike

当我输入大约三个或更多关键字时,它似乎只搜索最后一个关键字,即 sydney+region+nsw 它只会搜索 nsw

我希望它在输入时搜索多个关键字或完整的搜索词。

这是代码:

if($_REQUEST['searchkey']!="" && $_REQUEST['searchkey']=="search_record"){
//Remove any html/javascript.
$keyword = secureValue($_REQUEST['keyword']);
$cat_id = intval($_REQUEST['cat_level_root']);
$subcat_id = intval($_REQUEST['cat_level_one']);
$sub_subcat_id = intval($_REQUEST['cat_level_two']);
$stateId = intval($_REQUEST['classi_state']);
$hometownId = intval($_REQUEST['classi_zipcode']);
$servicesId = intval($_REQUEST['classified_desc9']);
$cityId = intval($_REQUEST['classi_city']);
$priceId = intval($_REQUEST['classified_title9']);
$ad_key = intval($_REQUEST['ad_id']);

$types = array();
$types_x = explode(" ",$keyword);
$keyword = trim($_REQUEST['keyword']);
foreach($types_x as $keyword) {
$x++;
if($x==0)
$types[]=($keyword!="" && $keyword!="Enter Your Keywords..") ? " " : "";
}
$types=implode($types);
$columns = "SELECT SQL_CALC_FOUND_ROWS * ";
$sql = " FROM tbl_classified
WHERE clsd_sub_subcat_id=1395 AND CONCAT(classified_title, ' ',
classified_desc, ' ', classified_type6, ' ', classified_title2, ' ",
classified_type, ' ', classified_type2, ' ', classified_type3, ' ',
classified_desc3, ' ', classified_type5) LIKE '%$keyword%'
and classified_status='Active'
and paid_status!='Pending'
ORDER BY classified_post_date,classified_featured asc $types";
$sql = $columns.$sql;
$rs_classi=db_query($sql);
$res_classi = mysql_fetch_array(db_query("Select FOUND_ROWS() as total"));
$reccnt=$res_classi['total'];
}

最佳答案

您用空格分解关键字字符串。 $types_x =explode("",$keyword);

使用+爆炸(例如explode("+", $keyword))或使用urldecode爆炸之前。

关于php - 我试图让这段代码进行多个关键字搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23680070/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com