In EmpireCMS, you may occasionally need to use the `IN` query – specifically, within a multi-condition query:

When using this, I noticed that the IN query wasn't returning the expected results; therefore, I searched through the PHP code and found that the following function needed to be modified!
function SearchDoKeyboard($f,$hh,$keyboard){
// print_r($keyboard);echo "<br>";
$where='';
$keyboard=SearchDoKeyboardVar($keyboard);
if(empty($keyboard))
{
return "";
}
if(!empty($hh))
{
if($hh=='LT')//小于
{
$where=$f."<'".$keyboard."'";
}
elseif($hh=='GT')//大于
{
$where=$f.">'".$keyboard."'";
}
elseif($hh=='EQ')//等于
{
$where=$f."='".$keyboard."'";
}
elseif($hh=='LE')//小于等于
{
$where=$f."<='".$keyboard."'";
}
elseif($hh=='GE')//大于等于
{
$where=$f.">='".$keyboard."'";
}
elseif($hh=='NE')//不等于
{
$where=$f."<>'".$keyboard."'";
}
elseif($hh=='IN')//包含
{
$kr=explode(' ',$keyboard);
$kcount=count($kr);
$kbs='';
$dh='';
for($i=0;$i<$kcount;$i++)
{
$kr[$i]=(float)$kr[$i];
// print_r($kr[$i]);echo "<br>";
if(empty($kr[$i]))
{
continue;
}
if($kbs)
{
$dh=',';
}
$kbs.=$dh."'".$kr[$i]."'";
}
if($kbs)
{
$where=$f." IN (".$kbs.")";
}
else
{
return '';
}
}
elseif($hh=='BT')//范围
{
$keyboard=ltrim($keyboard);
if(!strstr($keyboard,' '))
{
return '';
}
$kr=explode(' ',$keyboard);
$kr[0]=(float)$kr[0];
$kr[1]=(float)$kr[1];
if(!trim($kr[0])||!trim($kr[1]))
{
return '';
}
$where=$f." BETWEEN '".$kr[0]."' and '".$kr[1]."'";
}
else//相似
{
$where=$f." LIKE '%".$keyboard."%'";
}
}
else
{
$where=$f." LIKE '%".$keyboard."%'";
}
return $where;
}Simply comment out the following code:
$kr[$i]=(float)$kr[$i];This code converts a string value to a floating-point type, causing the subsequent data check to return `None`; therefore, simply comment out this line of code.
Perform a direct search – simply locate and delete this line or its associated comment.