$where = "";
$keywords =preg_split('/[\s]+/', $keywords);
$total_keywords = count($keywords);
foreach($keywords as $key=>$keyword) {
$where .= "`title` LIKE '%$keyword%'";
if ($key != ($total_keywords - 1)) {
$where .= " AND ";
}
}
$results = "SELECT `id`, `username`, `title`, LEFT(`description`, 90) as `description`, `file`, `code`, `type`, `size`, `date` FROM `files` WHERE $where ORDER BY id DESC LIMIT $start, $per_page";
$where .= "`title` LIKE '%$keyword%'"; // this case I am searching only in column `title` I want to search too in column `type` with sign '.' I don't know how to include '.' in search result for `type`
示例搜索 file.exe 并使用此条件 file.exe 获取所有结果。或者 somebode search only .exe get all results with type
.exe $where .= " title
, type
LIKE '%$keyword%'";//我这样做没有结果 $where .= " title
AND type
LIKE '%$keyword%'" ;//我这样做没有结果 $where .= " title
LIKE '%$keyword%' AND type
LIKE '%$keyword%'";//我这样做没有结果有人知道我怎么能得到我的结果标题类型带有符号“。”???