我有一个文本框名称是技能,如果管理员输入技能名称,我们将根据数据库字段中的用户技能获取用户数据。它会正常工作。我可以根据技能设置显示所有用户数据。
我的要求是,如果管理员在Resume中搜索技能提及用户的任何技能。我需要基于简历还在codeigniter中显示数据。请问任何人请帮助解决这个问题。请在模型中找到以下QUERY。
SELECT js_simple.js_id,js_simple.firstname,js_skills_achievements.skill,js_ResumeDetails.fileResume,js_ResumeDetails.profileImage FROM js_simple LEFT JOIN js_skills_achievements ON js_skills_achievements.js_id = js_simple.js_id WHERE js_skills_achievements.skill = '".trim($skill)."'
这对我有用,我的要求是用户有简历。在简历中假设用户提及的技巧是PHP,JAVA,SQL。如果管理员搜索任何技能RESUME我也需要搜索。在codeigniter模型中查询是什么。
<form id="advance_search" action="" method="post">
<div class="col-md-8" style="border: 2px solid lightgray;padding: 0px 0px 9px 0px;">
<div class="advanced_serach_bg" style="background: #4a90cc;">
<div class="col-md-8">
<h4 style="color:#fff;"> Quick Search </h4>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label style="color:#323232;" for="pincode">Any keyword</label>
<input style="color:#535353; background:#f1f1f1;height: 35px;" id="keywords" class="form-control" name="keywords" type="text">
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label style="color:#323232;" for="pincode">Location</label>
<input style="color:#535353; background:#f1f1f1;" id="location" class="form-control" name="location" placeholder="Enter Location" type="text">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label style="color:#323232;" for="activein">Active in:</label>
<select style="background: #4a90cc;color:#fff;margin-top:2px;" name="active_records" id="active_records" class="form-control" >
<option value='3 day'> 3 days</option>
<option value='1 week'> 1 week</option>
<option value='30 day'> 30 days</option>
<option value='2 MONTH'> 2 months</option>
<option value='3 MONTH'> 3 months</option>
<option value='4 MONTH'> 4 months</option>
<option value='5 MONTH'> 5 months</option>
<option value='6 MONTH'> 6 months</option>
<option value='7 MONTH'> 7 months</option>
<option value='8 MONTH'> 8 months</option>
<option value='9 MONTH'>9 months</option>
<option value='10 MONTH'> 10 months</option>
<option value='11 MONTH'> 11 months</option>
<option value='12 MONTH'> 12 months</option>
<option value='10 Year'> 1 + Year</option>
</select>
</div>
</div>
<div class="clearfix"></div>
<br>
<div class="form-group">
<div class="col-md-offset-5 col-sm-4">
<input type="submit" value="Search" class="btn btn-normal subbtn">
</div>
</div>
</div>
</form>
<script>
$(function(){
$('form#advance_search').submit(function(e) {
e.preventDefault();
var formData = $('form#advance_search').serializeArray();
//var keywords = $('#keywords').tagEditor('getTags')[0].tags;
//console.log(keywords);
$.ajax({
url:"<?php echo base_url();?>newrecruiter_control/candidate_advance_search",
type:"post",
data:formData,
success:function(data) {
window.location.href="<?php echo base_url();?>newrecruiter_control/search_candidate";
}
});
});
});</script>
public function candidate_advance_search() {
$this->recruiter_model->delete_candidate_search();
$data['job_seeker'] = $this->recruiter_model->advance_candidate_search();
}
<?php
public function advance_candidate_search() {
$data = array(
'active_records' => $this->input->post('active_records')?$this->input->post('active_records'):'3 day',
'search_keyword' => $this->input->post('keywords')?$this->input->post('keywords'):'',
'semantic_search' => $this->input->post('search_mode')?$this->input->post('search_mode'):'ON',
'search_in_resume' => 'NO' //$this->input->post('search_resume')
);
$sql_query = $this->db->select('*')
->from('recruiter_recent_search_results')
->where('recruiter_id',$this->session->userdata('recruiter_id'))
->get();
if($sql_query->num_rows() >= 5 ){
$this->db->delete('recruiter_recent_search_results',array('recruiter_id' => $this->session->userdata('recruiter_id')));
}else{
$exp = $data['min_experience'];
$this->db->insert('recruiter_recent_search_results',array('recruiter_id' => $this->session->userdata('recruiter_id'),'skills' => strtoupper($data['search_keyword']), 'location' => ucfirst($data['location']),'experience' => $exp));
}
if($data['search_in_resume'] == 'YES') {
/*
if($data['semantic_search'] == 'OFF') {
$response_array = $this->getAdvanceSearchResultInResume($data);
}else{
$response_array = $this->getAllSearchResultInResume($data);
}*/
}else{
if($data['semantic_search'] == 'OFF') {
$response_array = $this->getAdvanceSearchResult($data);
}else{
$response_array = $this->getAllSearchResult($data);
}
}
}
public function getAllSearchResult($data) {
$search_query = "SELECT js_simple.js_id,js_simple.firstname,js_simple.lastname,js_simple.added_date,js_skills_achievements.skill1,js_ResumeDetails.percentage,js_ResumeDetails.fileResume,js_ResumeDetails.profileImage,js_ResumeDetails.profile_type,js_ResumeDetails.about_self FROM js_simple LEFT JOIN js_skills_achievements ON js_skills_achievements.js_id = js_simple.js_id LEFT JOIN js_ResumeDetails ON js_ResumeDetails.js_id = js_simple.js_id WHERE js_simple.added_date >= DATE_SUB(NOW(),INTERVAL ".$data['active_records']." ) ";
if($data['search_keyword'] != NULL) {
$search_key = explode(',',$data['search_keyword']);
if(count($search_key) == 1) {
$search_query .= " AND (js_skills_achievements.skill1 = '".trim($search_key[0])."' OR js_ResumeDetails.about_self LIKE '%".trim($search_key[0])."%')";
$str = $this->db->last_query($search_query);
echo $str;
}
}
$search_query .= " GROUP BY js_simple.js_id ORDER BY js_simple.added_date DESC LIMIT ".$data['sort_by'];
$response = $this->db->query($search_query);
// return $this->db->last_query();
return $response->result_array();
}
public function getAdvanceSearchResult($data) {
$this->db->select('*');
$this->db->from('js_simple,js_skills_achievements,js_ResumeDetails');
$this->db->join('js_skills_achievements','js_skills_achievements.js_id = js_simple.js_id','left');
$this->db->join('js_ResumeDetails','js_ResumeDetails.js_id = js_simple.js_id','left');
$this->db->where("js_simple.added_date >= DATE_SUB(NOW(),INTERVAL ".$data['active_records']." )",NULL,FALSE);
if($data['search_keyword'] != NULL) {
$search_key = explode(',',$data['search_keyword']);
if(count($search_key) == 1) {
$this->db->where('js_skills_achievements.skill1',$search_key[0]);
}
}
$this->db->group_by('js_simple.js_id');
$this->db->order_by('js_simple.added_date','desc');
if($data['sort_by'] != NULL) {
$this->db->limit($data['sort_by']);
}
$search_response = $this->db->get();
return $search_response->result_array();
}
public function getAllSearchResultInResume($data) {
$jobseekers = '';
$get_js_details = $this->getAllSearchResult($data);
foreach($get_js_details as $key => $jobseeker) {
if($jobseekers == NULL) {
$jobseekers .= $jobseeker['js_id'];
}else{
$jobseekers .= ','.$jobseeker['js_id'];
}
}
}
?>