//POST信息
$startAge=$_POST['startAge'];
$endAge=$_POST['endAge'];
$gender=$_POST['gender'];
$state=$_POST['state'];
$country=$_POST['country'];
$sports=$_POST['sports'];
$add="where 1";
//比较起始年龄大小
if(!empty($startAge)&&!empty(endAge)&&$startAge <$endAge)
{$startAge=$startAge;$endAge=$endAge;$add.=" AND age>={$startAge} AND age <={$endAge}";}
elseif(!empty($startAge)&&!empty(endAge)&&$startAge>$endAge)
{$startAge=$endAge;$endAge=$startAge;$add.=" AND age>={$startAge} AND age <={$endAge}";}
else echo '请将年龄的起始填写完整';
//性别限制
if(!empty($gender['male'])&&!empty($gender['female']))
elseif(!empty(gender['male'])) $add.=" AND gender ='male'";
elseif(!empty(gender['female'])) $add.=" AND gender='female'";
$add.=!empty($startAge)&&!empty(endAge)?" AND age>={$startAge} AND age <={$endAge}":'';
$add.=!empty($state)?" AND state={$state}":'';
$add.=!empty($country)?" AND country={$country}":'';
$add.=!empty($sports)?" AND sports={$sports}":'';红色字地方是不是忘记加上`$`了!
$startAge=$_POST['startAge'];
$endAge=$_POST['endAge'];
$gender=$_POST['gender'];
$state=$_POST['state'];
$country=$_POST['country'];
$sports=$_POST['sports'];
$add="where 1";
//比较起始年龄大小
if(!empty($startAge)&&!empty(endAge)&&$startAge <$endAge)
{$startAge=$startAge;$endAge=$endAge;$add.=" AND age>={$startAge} AND age <={$endAge}";}
elseif(!empty($startAge)&&!empty(endAge)&&$startAge>$endAge)
{$startAge=$endAge;$endAge=$startAge;$add.=" AND age>={$startAge} AND age <={$endAge}";}
else echo '请将年龄的起始填写完整';
//性别限制
if(!empty($gender['male'])&&!empty($gender['female']))
elseif(!empty(gender['male'])) $add.=" AND gender ='male'";
elseif(!empty(gender['female'])) $add.=" AND gender='female'";
$add.=!empty($startAge)&&!empty(endAge)?" AND age>={$startAge} AND age <={$endAge}":'';
$add.=!empty($state)?" AND state={$state}":'';
$add.=!empty($country)?" AND country={$country}":'';
$add.=!empty($sports)?" AND sports={$sports}":'';红色字地方是不是忘记加上`$`了!
$startAge=$_POST['startAge'];
$endAge=$_POST['endAge'];
$gender=$_POST['gender'];
$state=$_POST['state'];
$country=$_POST['country'];
$sports=$_POST['sports'];
$add="where 1";
//比较起始年龄大小
if(!empty($startAge)&&!empty(endAge)&&$startAge <$endAge)
{$startAge=$startAge;$endAge=$endAge;$add.=" AND age>={$startAge} AND age <={$endAge}";}
elseif(!empty($startAge)&&!empty(endAge)&&$startAge>$endAge)
{$startAge=$endAge;$endAge=$startAge;$add.=" AND age>={$startAge} AND age <={$endAge}";}
else echo '请将年龄的起始填写完整';
//性别限制
if(!empty($gender['male'])&&!empty($gender['female']))
elseif(!empty(gender['male'])) $add.=" AND gender ='male'";
elseif(!empty(gender['female'])) $add.=" AND gender='female'";
$add.=!empty($startAge)&&!empty(endAge)?" AND age>={$startAge} AND age <={$endAge}":'';
$add.=!empty($state)?" AND state={$state}":'';
$add.=!empty($country)?" AND country={$country}":'';
$add.=!empty($sports)?" AND sports={$sports}":'';接1楼的。还有2个