私のコードに問題があるかどうかを知りたいのですが。コード中括弧では、中括弧が開いていても閉じていても、中括弧は上の中括弧と一致しません。のPHPコード中かっこは機械化されていませんが、コードは実行されません
<?php
include_once 'dbconnect.php';
if(isset($_POST['page']))
{
$page = $_POST['page'];
$cur_page = $page;
$page -= 1;
$per_page=10;
$previous_btn = true;
$next_btn = true;
$first_btn = true;
$last_btn = true;
$start = $page * $per_page;
if(!empty($_POST['run']))
{
$value1=$_POST['run'];
$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 a.run like '%$value1%' ";
}
else if(!empty($_POST['project']))
{
$value1=$_POST['project'];
$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 a.project like '%$value1%'";
}
else if(!empty($_POST['sample']))
{
$value1=$_POST['sample'];
$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 a.sample_id like '%$value1%'";
}
else if(!empty($_POST['bases']))
{
$value1=$_POST['bases'];
$values=$_POST['select1'];
switch($values)
{
case "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)) > '$value1' ORDER by (b.raw_bases + IFNULL(c.raw_bases2,0)) asc";
break;
case "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)) >= '$value1' ORDER by (b.raw_bases + IFNULL(c.raw_bases2,0)) asc ";
break;
case "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)) < '$value1' ORDER by (b.raw_bases + IFNULL(c.raw_bases2,0)) desc ";
break;
case "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)) <= '$value1' ORDER by (b.raw_bases + IFNULL(c.raw_bases2,0)) desc ";
break;
case "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)) = '$value1' ";
break;
}
}
else if(!empty($_POST['reads']))
{
$value5=$_POST['reads'];
$values2=$_POST['select2'];
switch($values2)
{
case "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_reads + IFNULL(c.raw_reads2,0)) > '$value5' ORDER by (b.raw_reads + IFNULL(c.raw_reads2,0)) asc";
break;
case "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_reads + IFNULL(c.raw_reads2,0)) >= '$value5' ORDER by (b.raw_reads + IFNULL(c.raw_reads2,0)) asc";
break;
case "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_reads + IFNULL(c.raw_reads2,0)) < '$value5' ORDER by (b.raw_reads + IFNULL(c.raw_reads2,0)) desc";
break;
case "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_reads + IFNULL(c.raw_reads2,0)) <= '$value5' ORDER by (b.raw_reads + IFNULL(c.raw_reads2,0)) desc";
break;
case "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_reads + IFNULL(c.raw_reads2,0)) = '$value5' ";
break;
}
}
// multiple combination search code starts
if(!empty($_POST['run']) && !empty($_POST['project']))
{
$valueR=$_POST['run'];
$valueP=$_POST['project'];
$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 a.run like '%$valueR%' AND a.project like '%$valueP%'";
}
else if(!empty($_POST['project']) && !empty($_POST['sample']))
{
$valueP=$_POST['project'];
$valueS=$_POST['sample'];
$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 a.project like '%$valueP%' AND a.sample_id like '%$valueS%'";
}
else if(!empty($_POST['sample']) && !empty($_POST['run']))
{
$valueS=$_POST['sample'];
$valueR=$_POST['run'];
$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 a.sample_id like '%$valueS%' AND a.run like '%$valueR%'";
}
else if(!empty($_POST['run']) && !empty($_POST['bases']))
{
$valueR=$_POST['run'];
$value123=$_POST['bases'];
$valuesS1=$_POST['select1'];
switch($valuesS1)
{
case "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)) > '$value123' AND a.run LIKE '%$valueR%' ORDER by (b.raw_bases + IFNULL(c.raw_bases2,0)) ASC ";
break;
case "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)) >= '$value123' AND a.run LIKE '%$valueR%' ORDER by (b.raw_bases + IFNULL(c.raw_bases2,0)) ASC ";
break;
case "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)) < '$value123' AND a.run LIKE '%$valueR%' ORDER by (b.raw_bases + IFNULL(c.raw_bases2,0)) DESC ";
break;
case "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)) <= '$value123' AND a.run LIKE '%$valueR%' ORDER by (b.raw_bases + IFNULL(c.raw_bases2,0)) DESC";
break;
case "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)) = '$value123' AND a.run LIKE '%$valueR%' ORDER by (b.raw_bases + IFNULL(c.raw_bases2,0))";
break;
}
}
else if(!empty($_POST['run']) && !empty($_POST['reads']))
{
$valueR=$_POST['run'];
$value51=$_POST['reads'];
$valuesS2=$_POST['select2'];
switch($valuesS2)
{
case "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_reads + IFNULL(c.raw_reads2,0)) > '$value51' AND a.run LIKE '%$valueR%' ORDER by (b.raw_reads + IFNULL(c.raw_reads2,0)) asc ";
break;
case "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_reads + IFNULL(c.raw_reads2,0)) >= '$value51' AND a.run LIKE '%$valueR%' ORDER by (b.raw_reads + IFNULL(c.raw_reads2,0)) ASC ";
break;
case "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_reads + IFNULL(c.raw_reads2,0)) < '$value51' AND a.run LIKE '%$valueR%' ORDER by (b.raw_reads + IFNULL(c.raw_reads2,0)) DESC ";
break;
case "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_reads + IFNULL(c.raw_reads2,0)) <= '$value51' AND a.run LIKE '%$valueR%' ORDER by (b.raw_reads + IFNULL(c.raw_reads2,0)) DESC";
break;
case "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_reads + IFNULL(c.raw_reads2,0)) = '$value51' AND a.run LIKE '%$valueR%' ORDER by (b.raw_reads + IFNULL(c.raw_reads2,0)) ";
break;
}
}
} ?>
私のコードに問題があるかどうかを知りたい。コード中括弧では、中括弧が開いていても閉じていても、中括弧は上の中括弧と一致しません。
plz私はPHPの初心者です – vinod
適切な字下げを試してください - いつもこの種の問題がどこにあるのかを助けてください – RamRaider
あなたのコードに問題はありません。すべての括弧が一致します。 – Hannan