Thank you its work
Now i want to filter search more..
Tables "Organization" and "opportunity"
Organization may not have opporunity
$q=$_POST["q"];
$search = '';
$the_array = explode(' ', $q);
$i = 0;
foreach( $the_array AS $t ){
if( $i == 0 ){
$search .= " '%$t%' ";
$i = 1;
}else{
$search .= " OR org_name LIKE '%$t%' ";
}
}
$query = "SELECT org_name, phyadd_city ";
$query.="FROM ".$prefix."_organization where (org_name like $search )";
// Shows only those org who has volunter opportunity
if(!empty($opor)){
$query.=" JOIN ".$prefix."_volunteer_opor ON org_id='op_contact_org'";
}
// Weather org's opportunity needs ossd
if(!empty($ossd)){
$query.=" JOIN ".$prefix."_volunteer_opor ON org_id='op_contact_org' AND op_ossd ='1'";
}
//Org with website
if(!empty($www)){
$query.=" AND web_1 <>''";
}
//Org in selected city
if(is_array($city)){
$query.=" AND phyadd_city IN ('" . implode("','",$city)."')";
}
// search option 1 means search org_name or org_description field
if($searchin==1){
$query.=" OR org_desc LIKE $search";
}
The problem is here filter organization
who has opportunity
oppurtunity needs ossd
/ Shows only those org who has volunter opportunity
if(!empty($opor)){
$query.=" JOIN ".$prefix."_volunteer_opor ON org_id='op_contact_org'";
}
// Weather org's opportunity needs ossd
if(!empty($ossd)){
$query.=" JOIN ".$prefix."_volunteer_opor ON org_id='op_contact_org' AND op_ossd ='1'";
}