jizhicms 搜索和多字段查询语句

曹え 5811 发布于:2024-01-15 07:57:08

homeContent.php 在 202行下面添加:

  // 自定义搜索筛选
             $word = $this->frparam('word',1);
             $guojia = $this->frparam('guojia',1);
             $chengshi = $this->frparam('chengshi',1);
             if($word) $sql.=" and title like '%".$word."%' ";
             if($guojia) $sql.=" and guojia='".$guojia."'";
             if($chengshi) $sql.=" and chengshi='".$chengshi."'";


模版里面

<form action="/jrwm.html" method="GET">
							<div class="m-soe1  wow fadeInUp">
								<input name="molds" type="hidden" value="article" />
								<input type="text" name="word" id="" placeholder="搜索岗位……" class="inp" value="<?php echo $_GET['word'];?>">
								<input type="submit" class="btn" value="搜索">
							</div>
						
						<div class="m-sele1  wow fadeInUp">
							<div class="sel1">
								<select name="guojia" id="guojia">
								    <option value="">全部国家</option>
									{foreach get_field_select('article','guojia') as $v}
									<option value="{$v[1]}" {if($_GET['guojia']=$v[1])}selected="selected"{/if}>{$v[0]}</option>
									{/foreach}
								</select>
							</div>
						</div>
						</form>


觉得有用请点个赞吧!
0 140