my majority of values are filled but set_price column has few empty field. i want to select only when set_price is not empty or not ''. i am using mysql and datatype set for set price is set_price
varchar(50) NOT NULL,
MY Function:
function getAvilableServiceDetails($service_id,$select_from,$select_to,$select_weight,$dimesion_height,$dimesion_width,$dimesion_girth,$price_shorting)
{
global $objSmarty;
// echo $service_id."//".$select_from."//".$select_to."//".$select_weight."//".$dimesion_height."//".$dimesion_width."//".$dimesion_girth."//".$price_shorting; exit;
if($select_weight=='')
$select_weight=0;
if($dimesion_height!='')
$height_condition=" and dimesion_height>=".$dimesion_height;
else
$height_condition="";
if($dimesion_width!='')
$width_condition=" and dimesion_width>=".$dimesion_width;
else
$width_condition="";
if($dimesion_girth!='')
$girth_condition=" and dimesion_girth>=".$dimesion_girth;
else
$girth_condition="";
//===================searching condition=========================//
if($_SESSION['package_search_by']!='')
$searching_condition=" and service_type='".$_SESSION['package_search_by']."'";
else
$searching_condition="";
//=====================price shorting============================//
if($price_shorting!='')
{
if($price_shorting=='L_TO_H')
$order_by=" group by unique_id order by set_price ASC ";
else
$order_by=" group by unique_id order by set_price DESC ";
}
else
{
$order_by=" group by unique_id order by set_price ASC ";
}
if($select_from!='' && $select_to!='' && $service_id!='')
{
$select_query="select * from set_delivery_package_details where service_id='".$service_id."' and
dimesion_weight>=".$select_weight." and set_price IS NOT NULL and set_price<>'' and FIND_IN_SET ('".$select_from."',sel_countrys) and FIND_IN_SET ('".$select_to."',sel_countrys) and deleted='N' and status='Y' ".$searching_condition.$height_condition.$width_condition.$girth_condition.$order_by;
$this->dbh->Query($select_query);
if($this->dbh->num_rows>0)
{
$PackageData=$this->dbh->FetchAllResults($select_query);
$objSmarty->assign("PackageData", $PackageData);
}
else
{
$searching_error_message="Record Not Found";
$objSmarty->assign("searching_error_message", $searching_error_message);
}
}
else
{
$searching_error_message="Record Not Found Please Search Again";
$objSmarty->assign("searching_error_message", $searching_error_message);
}
}
The table which i am using: please click here
Aucun commentaire :
Enregistrer un commentaire