2017-05-04 18 views
-2

私のコードに問題があるかどうかを知りたいのですが。コード中括弧では、中括弧が開いていても閉じていても、中括弧は上の中括弧と一致しません。の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; 
     } 
    } 
    } ?> 

私のコードに問題があるかどうかを知りたい。コード中括弧では、中括弧が開いていても閉じていても、中括弧は上の中括弧と一致しません。

+0

plz私はPHPの初心者です – vinod

+0

適切な字下げを試してください - いつもこの種の問題がどこにあるのかを助けてください – RamRaider

+2

あなたのコードに問題はありません。すべての括弧が一致します。 – Hannan

答えて

0

PSR-1/PSR-2コードの書式設定に従っていれば、あなたの投稿のコメントに@Hannanが言ったように、すべての中括弧が正しく一致することがわかりました。以下は、PSR-1/PSR-2フォーマットに設定されたPHPStormを使用してインデントされたコードです。 (注:私はちょうどあなたができたと言って、あなたはPSR-1/PSR-2を使用しなければならないと言っておりません)を使用すると、ブラケットが閉じを見ることができるようになるように、私はそれらの閉じ括弧にコメントを追加することをお勧めし

<?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; 
         } 
        } 
       } 
      } 
     } 
    } 
} 
?> 

どの声明。あなたは、PHPで、あなたのコードが実行時に致命的なエラーをスローします;:[]{}(),.の一つが欠けていると思う場合は、さらに

      } // switch $valuesS2 
        } // if $_POST run & reads not empty 
       } // if POST run & bases not empty 
      } // if POST sample && run not empty 
     } // if POST project && sample not empty 
    } // if POST run && project not empty 
} // POST page isset 
?> 

:それは次のようになります。これは何かのようなものです(作業コードから削除しました、スタイリングxdebugfatal error after removing <code>;</code> from end of lineこれはもちろんコードの一部であるため、文字列に表示されていないときに致命的なエラーは発生しません。

+0

ur reply Jelmerguに感謝します。上のフォーマットされたコードでも最後に表示され、最初のカッコが範囲外です。 – vinod

+0

「範囲外」とはどういう意味ですか、それはPHP自体からのメッセージか、エディタによって生成されたメッセージですか? – Jelmergu

+0

はphpではなくエディタによって生成され、linux geditとphpfiddleに表示されます。コードはフロントエンドで正常に動作しています。その警告を表示するために何が問題になるかもしれません。 – vinod

関連する問題