The core code is as follows:
Copy CodeThe code is as follows:
$now =time ();
$oc = Array (
' Team_type ' = ' normal ',
"Begin_time < ' {$now} '",
"End_time > ' {$now} '",
);
$p = "P2";
$PP 1 = "";
$PP 2 = "";
$now = time ();
Switch ($p)
{
Case "P1":
$PP 1= "Team_price < 10";
$PP 2 = "";
Break
Case "P2":
$PP 1= "Team_price > 10";
$PP 2= "Team_price < 50";
Break
Case "P3":
$PP 1= "Team_price > 50";
$PP 2= "Team_price < 100";
Break
Case "P4":
$PP 1= "Team_price > 100";
$PP 2= "Team_price < 200";
Break
Case "P5":
$PP 1= "Team_price > 200";
$PP 2 = "";
Break
Default
$PP 1 = "";
$PP 2 = "";
}
if (!empty ($pp 1)) {
Array_push ($oc, $pp 1);
}
if (!empty ($pp 2)) {
Array_push ($oc, $pp 2);
}
Print_r ($OC);
?>
Because it is a multi-conditional query, it is necessary to determine whether it is empty before adding it to the array.
http://www.bkjia.com/PHPjc/324794.html www.bkjia.com true http://www.bkjia.com/PHPjc/324794.html techarticle The core code is as follows: The copy code is as follows: PHP $now =time (), $oc = Array (' team_type ' = ' normal ', "Begin_time ' {$now} '", "End_time ' {$now} '", ); $p = "P2"; $PP 1 = ""; $PP 2 = ""; $now ...