Php 您是否没有错误,但即使set_price为空,结果仍会打印?甚至您的else语句都没有。请看,我将完整的函数放在上面,如果set_price为空,即“我应该得到“未找到记录”,但它不起作用它给出输出,当我尝试另一种方法时,将set_price设置为任何其他
Php 您是否没有错误,但即使set_price为空,结果仍会打印?甚至您的else语句都没有。请看,我将完整的函数放在上面,如果set_price为空,即“我应该得到“未找到记录”,但它不起作用它给出输出,当我尝试另一种方法时,将set_price设置为任何其他,php,mysql,Php,Mysql,您是否没有错误,但即使set_price为空,结果仍会打印?甚至您的else语句都没有。请看,我将完整的函数放在上面,如果set_price为空,即“我应该得到“未找到记录”,但它不起作用它给出输出,当我尝试另一种方法时,将set_price设置为任何其他值,比如25,然后在查询中选中set_price='foo'。它正在工作,并给出了“未找到记录”。如何在第一种情况下执行相同操作。尝试为查询分配一个变量,以便$this->query=$this->dbh->query($select\u qu
您是否没有错误,但即使set_price为空,结果仍会打印?甚至您的else语句都没有。请看,我将完整的函数放在上面,如果set_price为空,即“我应该得到“未找到记录”,但它不起作用它给出输出,当我尝试另一种方法时,将set_price设置为任何其他值,比如25,然后在查询中选中set_price='foo'。它正在工作,并给出了“未找到记录”。如何在第一种情况下执行相同操作。尝试为查询分配一个变量,以便
$this->query=$this->dbh->query($select\u query)
然后从$this->query
对象中提取所有方法。
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);
}
}
$select_query =
"SELECT *
FROM set_delivery_package_details
WHERE service_id='".$service_id."'
AND dimesion_weight>=".$select_weight."
AND (set_price != NULL
OR set_price != ''
OR set_price IS NOT NULL
OR 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;
set_price != ''
trim(set_price) <> ''