- Beranda
- Komunitas
- Tech
- Programmer Forum
Help dong gan, mecahin masalah PHP MySQL yang ini...
TS
mikahoy045
Help dong gan, mecahin masalah PHP MySQL yang ini...
Jadi ceritanya ane punya tabel "dp"
Ane pengennya wktu querry sama proses my sql di php page jadi kayak gini :
Ini beberapa kode yang ane gunakan :
tapi hasilnya malah jadi kayak gini :
mohon bantuannya agan2?
PROBLEM SOLVED
Code:
Year | Month | Payment | Payer_ID |
2008/2009 | July | 100000 | 1 |
2008/2009 | August | 200000 | 1 |
2009/2010 | August | 150000 | 1 |
2009/2010 | September | 175000 | 1 |
Ane pengennya wktu querry sama proses my sql di php page jadi kayak gini :
Code:
Year | July | August | September |
2008/2009 | 100000 | 200000 | 0 |
2009/2010 | 0 | 150000 | 175000 |
Ini beberapa kode yang ane gunakan :
Code:
$query_Recordset1 = "SELECT * FROM dp WHERE payer_id='1' GROUP BY year, month";
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['year']; ?></td>
<td><?php
$monthfilter=$row_Recordset1['month'];
$valuefromfilter=$row_Recordset1['payment'];
if ($monthfilter == 'July')
{
echo $valuefromfilter;
}
else
{
echo "<center>";
echo "<font color=red><b>0</b></font>";
echo "</center><br>";
}
?></td>
<td>script for august</td>
<td>script for september</td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
tapi hasilnya malah jadi kayak gini :
Code:
Year | July | August | September |
2008/2009 | 0 | 200000 | 0 |
2008/2009 | 100000 | 0 | 0 |
2009/2010 | 0 | 0 | 175000 |
2009/2010 | 0 | 150000 | 0 |
mohon bantuannya agan2?
PROBLEM SOLVED
Spoiler for Solusinya:
0
1.5K
12
Komentar yang asik ya
Urutan
Terbaru
Terlama
Komentar yang asik ya
Komunitas Pilihan