Click here to Skip to main content
15,889,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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); // 31
        //$dates = date("$cYear-$Month-1");
        for($i=1;$i<=$num;$i++)
        {   $dates = date("$cYear-$Month-$i");
            //echo $dates.'<br/>';
            echo "<td width='26' height='20px' align='center' valign='middle' >".$i."</td>";
        }
        //echo "<br/>";
        $Month++;
    }
?>
    </tr>
</table>
<?php } ?>
Posted
Updated 13-Feb-11 22:31pm
v6

1 solution

This[^] may help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900