데이터가있는 다음과 같은 mysql 테이블이 있습니다. 그것은 다음과 같은 기록을 표시하는 동안날짜로 레코드를 수평으로 표시해야합니다.
:
내가 같은 HTML 테이블의 레코드를 표시하려면 : 데이터 테이블은 아래 사진에 표시됩니다
다음 코드를 가지고 있습니다.
<?php
$year = intval($_POST['year']);
$month = (intval($_POST['month']) < 10 && strlen($_POST['month']) < 2) ? '0'.intval($_POST['month']):intval($_POST['month']);
$sql = "SELECT sno,file_path,bench_sno,causelist_date,date_entry
FROM phc_causelists
WHERE YEAR(causelist_date) = :year AND MONTH(causelist_date) = :month ORDER BY causelist_date DESC";
$aryList = array(':year'=>$year,':month'=>$month);
if($db->dbQuery($sql,$aryList)){
?>
<strong>Causelists for the month of <?php echo($method->getMonthName(intval($month)).' '.intval($year)); ?> </strong>
<table class="table table-bordered">
<?php
foreach($db->getRecordSet($sql,$aryList) as $row){
?>
<tr>
<td><?php echo($row['causelist_date']); ?></td>
<td><?php if($row['bench_sno'] == '1'){ ?>
<a href="<?php echo($method->baseURL()); ?>/causeLists/<?php echo($row['file_path']); ?>">Peshawar High Court</a>
<?php } ?></td>
<td><?php if($row['bench_sno'] == '2'){ ?>
<a href="<?php echo($method->baseURL()); ?>/causeLists/<?php echo($row['file_path']); ?>">Abbottabad</a>
<?php } ?></td>
<td><?php if($row['bench_sno'] == '3'){ ?>
<a href="<?php echo($method->baseURL()); ?>/causeLists/<?php echo($row['file_path']); ?>">D.I.Khan</a>
<?php } ?></td>
<td><?php if($row['bench_sno'] == '4'){ ?>
<a href="<?php echo($method->baseURL()); ?>/causeLists/<?php echo($row['file_path']); ?>">Mingora</a>
<?php } ?></td>
<td><?php if($row['bench_sno'] == '5'){ ?>
<a href="<?php echo($method->baseURL()); ?>/causeLists/<?php echo($row['file_path']); ?>">Bannu</a>
<?php } ?></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
왜 유 넣어 [ 'bench_sno'] == '1') {**? –
나는 bench_sno에 대한 레이블을 포함하는 다른 테이블을 가지고 있습니다. 어디에 레이블 "PHC"에 대한 sno = 1, sno 2 Abbottabad 등 –
당신의 테이블 구조가 귀하의 PHP와 조건이 맞지 않는 것 같아요. –