0
我有表tb_satkerPHP和MySQL加入2數據表
kode_propinsi | nama_satker | kode_satker
500 | A | 1
500 | B | 2
500 | C | 3
500 | D | 4
也表tb_upload
kode_propinsi | kode_satker | month
500 | A | 1
500 | A | 2
500 | B | 3
我想創建PHP和MySQL的代碼來生成這樣
No | UPT | Jan | Feb | Mar | Apr | Mei | Jun | Jul | Ags | Sep | Okt | Nov | Des
1 | A | 1 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0
2 | B | 0 | 0 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0
3 | C | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0
4 | D | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0
表
這是我的php代碼,這是創建主表,在此代碼link
但如何使活動的映像表顯示,如果沒有值(0)和活動影像時,如果一個月充滿值(1/2/3/4 ...等)
<table class="table table-hover">
<thead>
<tr>
<th>No</th>
<th>UPT</th>
<th>Jan</th>
<th>Feb</th>
<th>Mar</th>
<th>Apr</th>
<th>Mei</th>
<th>Jun</th>
<th>Jul</th>
<th>Ags</th>
<th>Sep</th>
<th>Okt</th>
<th>Nov</th>
<th>Des</th>
</tr>
</thead>
<tbody>
<?
$view = "SELECT * FROM $tb_satker WHERE kode_propinsi='$propinsi'";
$result = mysql_query($view);
$jumlah=mysql_num_rows($result);
$nomor=0;
while
($baris=mysql_fetch_array($result))
{
$namasatker=$baris['nama_satker'];
$kodesatker=$baris['kode_satker'];
$kodepropinsi=$baris['kode_propinsi'];
$nomor=$nomor+1;
?>
<tr>
<th><? echo $nomor;?></th>
<th><? echo $namasatker;?></th>
<th><img src="images/inactive.png"></th>
<th><img src="images/inactive.png"></th>
<th><img src="images/inactive.png"></th>
<th><img src="images/inactive.png"></th>
<th><img src="images/inactive.png"></th>
<th><img src="images/inactive.png"></th>
<th><img src="images/inactive.png"></th>
<th><img src="images/inactive.png"></th>
<th><img src="images/inactive.png"></th>
<th><img src="images/inactive.png"></th>
<th><img src="images/inactive.png"></th>
<th><img src="images/inactive.png"></th>
<? }?>
</tr>
</tbody>
</table>
更新我的問題 – PNBP 2014-10-21 03:19:15
是,創建主表,但條件語句尚未表(積極的,如果存在的價值和非活動如果沒有值) – PNBP 2014-10-21 03:34:47