Welcome Guest, Not a member yet? Register   Sign In
sql to filter data from dropdown boxes
#3

[eluser]max123[/eluser]
This is my code. The conditions inside the if statements are not working. It means the filtering doesn't happen

function search_vacancies($data)
{
$key_word=$data['key_word'];
echo $category=$data['category'];
$city_state=$data['city_state'];

$sql = " SELECT tt_vac_vacancies.s_vac_designation,tt_rec_recruiters.s_rec_company_name,city_states.city_name,countries.country_name, tt_vac_vacancies.end_date, tt_vac_vacancies.i_vac_ID FROM tt_vac_vacancies
LEFT JOIN tt_rec_recruiters ON tt_vac_vacancies.l_vac_account_ID = tt_rec_recruiters.l_rec_ID
LEFT JOIN city_states ON tt_vac_vacancies.city_id = city_states.city_id
LEFT JOIN countries ON city_states.country_id = countries.country_id ";

if($category!=0)
$sql = $sql. "AND tt_vac_vacancies.l_vac_job_category = ". $category;
if($city_state!=0)
$sql = $sql. "AND tt_vac_vacancies.city_id = ". $city_state;


$query=$this->db->query($sql);

return $query;
}


Messages In This Thread
sql to filter data from dropdown boxes - by El Forum - 02-08-2010, 05:21 AM
sql to filter data from dropdown boxes - by El Forum - 02-08-2010, 08:00 AM
sql to filter data from dropdown boxes - by El Forum - 02-09-2010, 07:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB