hi
i am making a leave calendar i have made the calendar ...using this code
make some changes find few more functions in php which make things lot easy ...
but need help to make a good sql query to show data and compare them.
now confused where to put sql query if i put in the loops it will take lots of time to compare and show data ...what can be the best solution for this ...
plz help now ....
<pre lang="php">$sql ="SELECT leave_date,leave_status,leave_type_id FROM `hs_hr_leave` WHERE employee_id = $emplid ";
$res = mysql_query($sql);
while ($row = mysql_fetch_array($res, MYSQL_NUM)) {
echo "<tr>";
echo '<td>'.$row[0].'</td><br/>';
echo "<td>".$row[1]."</td><br/>";
echo "<td>".$row[2]."</td><br/>";
echo "</tr>";
}
<<pre lang="xml">?php
if (isset($emplistshow) && ($emplistshow == 'show')) {
$monthNames = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
?>
<div class="outerbox" style=" float: left;">
<table colspan="5" rowspan="4">
<tr >
<td width="18%" colspan="2"><strong>Month</strong></td>
<td width="12%" colspan="2"><strong>Division</strong></td>
<?php for($m=1;$m <=31;$m++) { ?>
<td width="26" height="20px" align="center" valign="middle" ><?php echo $m; ?></td>
<?php } ?>
</tr>
</table>
</div>
<div class="outerbox" style=" float: left;">
<table >
<?php for($Month=1;$Month <= 12;) { ?>
<tr>
<td width="18%" colspan="2"><strong><?php echo $monthNames[$Month-1]; ?></strong></td>
<td width="12%" colspan="2"><strong>Division</strong></td>
<?php
$num = cal_days_in_month(CAL_GREGORIAN, $Month, $cYear);
for($i=1;$i<=$num;$i++)
{ $dates = date("$cYear-$Month-$i");
echo "<td width='26' height='20px' align='center' valign='middle' >".$i."</td>";
}
$Month++;
}
?>
</tr>
</table>
<?php } ?>