<?php
include_once 'dbconnect.php';
if(isset($_POST['page']))
{
$page = $_POST['page'];
//@$author=$_REQUEST['author'];
$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']))
{
$values=$_POST['select1'];
if($values=='greaterthan')
{
$value1=$_POST['bases'];
$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";
}
else if($values=='greaterthanorequal')
{
$value1=$_POST['bases'];
$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 ";
}
else if($values=='lessthan')
{
$value1=$_POST['bases'];
$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 ";
}
else if($values=='lessthanorequal')
{
$value1=$_POST['bases'];
$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 ";
}
else if($values=='equal')
{
$value1=$_POST['bases'];
$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' ";
}
}
else if(!empty($_POST['reads']))
{
$values2=$_POST['select2'];
if($values2=='greaterthan')
{
$value5=$_POST['reads'];
$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";
}
else if($values2=='greaterthanorequal')
{
$value5=$_POST['reads'];
$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";
}
else if($values2=='lessthan')
{
$value5=$_POST['reads'];
$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";
}
else if($values2=='lessthanorequal')
{
$value5=$_POST['reads'];
$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";
}
else if($values2=='equal')
{
$value5=$_POST['reads'];
$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' ";
}
}
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'];
$values3=$_POST['select1'];
if($values3=='greaterthan')
{
$value123=$_POST['bases'];
$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 ";
}
else if($values3=='lessthan')
{
$value123=$_POST['bases'];
$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 ";
}
else if($values3=='greaterthanorequal')
{
$value123=$_POST['bases'];
$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 ";
}
else if($values3=='lessthanorequal')
{
$value123=$_POST['bases'];
$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 ";
}
else if($values3=='equal')
{
$value123=$_POST['bases'];
$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)) ";
}
}
}
if( @$result = mysqli_query($link, $sql." LIMIT $start, $per_page " ) ) {
if(mysqli_num_rows($result) > 0){
?>
<table width="85%" border="1" align="center" id='t01' >
<tr>
<th>Sno </th>
<th>Run</th>
<th>Lane</th>
<th>Sample Name</th>
<th>End Type</th>
<th>Project Name</th>
<th>Total Raw Bases</th>
<th>Bases(In Gbp)</th>
<th>Total Raw Reads</th>
<th>Reads(In Mbp)</th>
</tr>
<?php
while($row = mysqli_fetch_array($result)){
?>
<tr>
<td align="center"><?php echo ++$counter;?> </td>
<td align="center"><?php echo $row['run'] ;?> </td>
<td align="center"><?php echo $row['lane'] ;?> </td>
<td align="center"><?php echo $row['sample_id']; ?></td>
<td align="center"><?php echo $row['end_type'] ;?> </td>
<td align="center"><?php echo $row['project'] ;?> </td>
<td align="center"><?php $a=(($row['raw_bases'])+($row['raw_bases2'])); echo $a;?> </td>
<td align="center"><?php $a=(($row['raw_bases'])+($row['raw_bases2']))/1000000000; $var = floor($a*100)/100; echo $var;?> </td>
<td align="center"><?php $b=(($row['raw_reads'])+($row['raw_reads2'])); echo $b;?> </td>
<td align="center"><?php $b=(($row['raw_reads'])+($row['raw_reads2']))/1000000; $var = floor($b*100)/100; echo $var;?> </td>
</tr>
<?php
}
// Close result set
// mysqli_free_result($result);
}
else{
echo " No records matching your query were found.";
}
?>
</table>
我的脚本中有大括号的问题。当我在if( @$result = mysqli_query($link, $sql." LIMIT $start, $per_page " ) )
之前关闭大括号时,它显示括号匹配超出范围但代码工作正常。另外,我可以在else if
使用if((!empty($_POST['run'])) && (!empty($_POST['project'])))
吗?我使用else if
但代码不起作用。谁能告诉我这是什么问题?