I have problem with my if else statement. I want to show popup box which is a list of late submission.
All i going alright, but there are problem when there are no late submission.
The popup block still appear when it supposed not appear when there are no late submission. I think the problem is the if else closing. I already tried change the code. When I add the closing statement, the popup block dissappear, but the list of late submissions from my MySQL only appear 1 row. Please help me. Thank you in advanced.
Here my code without if else statement:
<?php echo "<div id='hideshow'><div id='fade'></div><div class='popup_block'><div class='popup'><a href='javascript:hideDiv()'><img src='image/icon_close.png' class='cntrl' title='Close' /></a><h3><div class='font'>Pinjaman Melebihi Tarikh Pulang</div></h3>
<table width='700'>
<table width='700' class='visi'>
<tr><th colspan='5'></th></tr>
<tr>
<td width='95' bgcolor='#69F'><center><strong><font face='arial' color='white'>NOMBOR PEKERJA</font></strong></center></td>
<td width='101' bgcolor='#69F'><center><strong><font face='arial' color='white'> NAMA PEKERJA</font></strong></center></td>
<td width='107' bgcolor='#69F'><center><strong><font face='arial' color='white'> NO. TRACK</font></strong></center></td>
<td width='144' bgcolor='#69F'><center><strong><font face='arial' color='white'>NO. RUJUKAN</font></strong></center></td>
<td width='89' bgcolor='#69F'><center><strong><font face='arial' color='white'><center>TARIKH PULANG</center></font></strong></center></td>
<td width='49' bgcolor='#69F'><center><strong><font face='arial' color='white'><center>LIHAT</center></font></strong></center></td>
</tr>
</table>";?>
<?php
$date = date("d/m/Y");
$query = "SELECT * FROM pinjaman WHERE statusPinjaman = 'Pinjam' AND NOW() >= tarikhPulang";
$result = mysql_query($query, $conn);
while($row = mysql_fetch_array($result)){
$noPinjaman = $row["noPinjaman"];
$ID = $row["ID"];
$noRujukan = $row["noRujukan"];
$tarikhPulang = $row["tarikhPulang"];
$tajuk = $row["tajuk"];
$namaStaff = $row["namaStaff"];
$noTrack = $row["noTrack"];
?>
<?php
echo "<table width ='700'>
<td width='95' bgcolor='#white'><center><font color='#0033CC' face='arial' size='2'>".$row['ID']."</font></center></td>
<td width='101' bgcolor='#white'><font color='#0033CC' face='arial' size='2'>".$row['namaStaff']."</font></td>
<td width='107' bgcolor='#white'><font color='#0033CC' face='arial' size='2'>".$row['noTrack']."</font></td>
<td width='144' bgcolor='#white'><font color='#0033CC' face='arial' size='2'>".$row['noRujukan']."</font></td>
<td width='89' bgcolor='#white'><center><font color='#0033CC' face='arial' size='2'>".$row['tarikhPulang']."</font></center></td>
<td width='49' bgcolor='#white'><center><a href='lihatPinjaman.php?noPinjaman=".$row['noPinjaman']."'>LIHAT</a></center></td>
</table>
</table>";
}
?>
</div></div></div></div>
Here my if else statement:
<?php
$date = date("d/m/Y");
if (strtotime($row['tarikhPulang']) < $date)
{
////code above
}
else
{
echo "";
}
?>