if field is empty then check it is empty or not then fire query
 $on[] = "(est.published = '1')";
	 
	if('ser.type'!="" && 'ser.type' !=null)
 	    { 
 		$on[] = "( ser.type = est.type )";
 	    } 

	if("ser.cat"=='0')
	    { 
		$on[] = "est.cat IN( 1,2,3 )"; 
	    }

	if('ser.cat'!='0' && 'ser.cat' !="" && 'ser.cat' !=null)
 	    {
 		$on[] = "( ser.cat = est.cat )";
 	    } 

 	if('ser.status'!="" && 'ser.status' !=null)
 	    { 
 		$on[] = "( ser.status = est.sold )";
 	    } 
 	if('ser.status'=='0')
 	    { 
 		$on[] = "( est.status = 0 )";
	    }
 
 	if('ser.size'!="" && 'ser.size' !=null)
 	    {
 		$on[] = "( ser.size <= est.space AND ser.size <= est.homes_size)";
 	    }
 
 	if('ser.bedroom'!="" && 'ser.bedroom' !=null)
 	    {
 		$on[] = "( ser.bedroom <= est.bedrooms )";
 	    }
 
 	if('ser.value'!= "" && 'ser.value' !=null)
 	    { echo "found not value";die;
    		$on[] = "( ser.value <= est.price )";
 	    }
    
 	if('ser.maxvalue'!="" && 'ser.maxvalue' !=null)
 	    {
 		$on[] = "( ser.maxvalue >= est.price )";
 	    } 
    /* 
	if('ser.keyword'!="" && 'ser.keyword' !=null)
	    { echo "keyword";die;
		$on[] =  "( ser.keyword LIKE '%'+est.obj_id+'%' ) ";
	    }
*/
       $on = ( count( $on ) ? ' WHERE ' . implode( ' AND ', $on ) : '' );
       $result12 = " SELECT est.* FROM `#__estateagent` AS est INNER JOIN `#__search` AS ser " . $on . "WHERE ser.id = $so AND ser.u_id = $u_id ";

if field is empty then check it is empty or not then fire query
===

 $on[] = "(est.published = '1')";
	 
	if('ser.type'!="" && 'ser.type' !=null)
 	    { 
 		$on[] = "( ser.type = est.type )";
 	    } 

	if("ser.cat"=='0')
	    { 
		$on[] = "est.cat IN( 1,2,3 )"; 
	    }

	if('ser.cat'!='0' && 'ser.cat' !="" && 'ser.cat' !=null)
 	    {
 		$on[] = "( ser.cat = est.cat )";
 	    } 

 	if('ser.status'!="" && 'ser.status' !=null)
 	    { 
 		$on[] = "( ser.status = est.sold )";
 	    } 
 	if('ser.status'=='0')
 	    { 
 		$on[] = "( est.status = 0 )";
	    }
 
 	if('ser.size'!="" && 'ser.size' !=null)
 	    {
 		$on[] = "( ser.size <= est.space AND ser.size <= est.homes_size)";
 	    }
 
 	if('ser.bedroom'!="" && 'ser.bedroom' !=null)
 	    {
 		$on[] = "( ser.bedroom <= est.bedrooms )";
 	    }
 
 	if('ser.value'!= "" && 'ser.value' !=null)
 	    { echo "found not value";die;
    		$on[] = "( ser.value <= est.price )";
 	    }
    
 	if('ser.maxvalue'!="" && 'ser.maxvalue' !=null)
 	    {
 		$on[] = "( ser.maxvalue >= est.price )";
 	    } 
    /* 
	if('ser.keyword'!="" && 'ser.keyword' !=null)
	    { echo "keyword";die;
		$on[] =  "( ser.keyword LIKE '%'+est.obj_id+'%' ) ";
	    }
*/
       $on = ( count( $on ) ? ' WHERE ' . implode( ' AND ', $on ) : '' );
       $result12 = " SELECT est.* FROM `#__estateagent` AS est INNER JOIN `#__search` AS ser " . $on . "WHERE ser.id = $so AND ser.u_id = $u_id ";
