Video to Audio
Count = 17
Audio to MKV
Count = 14
Video to Audio
Count = 61
Audio to MKV
Count = 23
我有两个搜索字段,我希望使用这两个字段组合选择选项来搜索数据,我想使用switch case来缩短代码,我知道如何使用select选项为一个字段编写switch case。但在这种情况下,我们必须使用选择选项一次搜索两个搜索字段。谁能帮我怎么写呢。
答案 0 :(得分:0)
if (!empty($_POST['bases']) && !empty($_POST['reads']))
{
$valueB=$_POST['bases'];
$values40=$_POST['select1'];
$valueR=$_POST['reads'];
$values41=$_POST['select2'];
switch (true){
case $values40=='greaterthan' && $values41=='greaterthan':
$sql="SELECT a.run, a.lane,a.project,a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) > '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) > '$valueR' ";
break;
case $values40=='greaterthan' && $values41=='greaterthanorequal':
$sql="SELECT a.run, a.lane,a.project,a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) > '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) >= '$valueR' ";
break;
case $values40=='greaterthan' && $values41=='lessthan':
$sql="SELECT a.run,a.lane,a.project,a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) > '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) < '$valueR' ";
break;
case $values40=='greaterthan' && $values41=='lessthanorequal':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) > '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) <= '$valueR' ";
break;
case $values40=='greaterthan' && $values41=='equal':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) > '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) = '$valueR' ";
break;
case $values40=='greaterthanorequal' && $values41=='greaterthan':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) >= '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) > '$valueR' ";
break;
case $values40=='greaterthanorequal' && $values41=='greaterthanorequal':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) >= '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) >= '$valueR' ";
break;
case $values40=='greaterthanorequal' && $values41=='lessthan':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) >= '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) < '$valueR' ";
break;
case $values40=='greaterthanorequal' && $values41=='lessthanorequal':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) >= '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) <= '$valueR' ";
break;
case $values40=='greaterthanorequal' && $values41=='equal':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) >= '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) = '$valueR' ";
break;
case $values40=='lessthan' && $values41=='greaterthan':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) < '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) > '$valueR' ";
break;
case $values40=='lessthan' && $values41=='greaterthanorequal':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) < '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) >= '$valueR' ";
break;
case $values40=='lessthan' && $values41=='lessthan':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) < '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) < '$valueR' ";
break;
case $values40=='lessthan' && $values41=='lessthanorequal':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) < '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) <= '$valueR' ";
break;
case $values40=='lessthan' && $values41=='equal':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) < '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) = '$valueR' ";
break;
case $values40=='lessthanorequal' && $values41=='greaterthan':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) <= '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) > '$valueR' ";
break;
case $values40=='lessthanorequal' && $values41=='greaterthanorequal':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) <= '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) >= '$valueR' ";
break;
case $values40=='lessthanorequal' && $values41=='lessthan':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) <= '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) < '$valueR' ";
break;
case $values40=='lessthanorequal' && $values41=='lessthanorequal':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) <= '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) <= '$valueR' ";
break;
case $values40=='lessthanorequal' && $values41=='equal':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) <= '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) = '$valueR' ";
break;
case $values40=='equal' && $values41=='greaterthan':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) = '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) > '$valueR' ";
break;
case $values40=='equal' && $values41=='greaterthanorequal':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) = '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) >= '$valueR' ";
break;
case $values40=='equal' && $values41=='lessthan':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) = '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) < '$valueR' ";
break;
case $values40=='equal' && $values41=='lessthanorequal':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) = '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) <= '$valueR' ";
break;
case $values40=='equal' && $values41=='equal':
$sql="SELECT a.run, a.lane, a.project, a.sample_id,a.end_type,b.raw_bases, b.raw_reads, c.raw_bases2, c.raw_reads2 FROM cp_sampleSheet a left JOIN cp_samp_R1 b ON a.sample_id = b.sample_id left JOIN cp_samp_R2 c ON a.sample_id =c.sample_id WHERE (b.raw_bases + IFNULL(c.raw_bases2,0)) = '$valueB' AND (b.raw_reads + IFNULL(c.raw_reads2,0)) = '$valueR' ";
break;
}
}