<?php if (isset($_POST['search'])) { $block = $_POST['block']; $shift = $_POST['shift']; $today = $_POST['date']; $total_sec; echo "<br/><br/><hr/>"; echo '<input type="hidden" name="blocks" value="' . $block . '" />'; echo '<input type="hidden" name="shifts" value="' . $shift . '" />'; echo "<div align=" . '"center">' . "Block: {$block} || Shift: {$shift} </div>"; echo "<hr/>"; $query = mysql_query("SELECT * from att WHERE date='{$today}' AND block='{$block}' AND shift='{$shift}'"); echo '<table cellpadding="5" cellspacing="0" border="1" class="style13"><tr><th>E_ID</th><th>Name</th><th>Check IN</th><th>Check Out</th><th>Total</th></tr>'; while ($row = mysql_fetch_array($query)) { $total_sec = $row[8]; $total_time = thour($total_sec); echo '<tr><td>' . $row[0] . '</td><td>' . $row[1] . '</td><td>' . $row[6] . '</td><td>' . $row[7] . '</td><td>' . $total_time . '</td> </tr>'; } } echo '</table>'; function thour($sec) { $hour = (int) ($sec / 3600); $sec = $sec % 3600; $min = (int) ($sec / 60); $sec = $sec % 60; $totalhour = $hour . " hour " . $min . " minute " . $sec . " sec "; return $totalhour; } ?>
</tr> <?php for ($x = 0; $x < sizeof($employlist); $x++) { $cemploy = $employlist[$x]; $query2 = "select * from att where date>='{$from}' and date<='{$to}' and name='{$cemploy}' and block='{$block}' and shift='{$shift}'"; $query3 = "select * from att where date>='{$from}' and date<='{$to}' and name='{$cemploy}' and block='{$block}'"; $query6 = "select * from att where date>='{$from}' and date<='{$to}' and name='{$cemploy}'"; $data2 = mysql_query($query6); $total = 0; $counter = 0; while ($res2 = mysql_fetch_array($data2)) { $shift1 = $res2[3]; $block1 = $res2[2]; $counter = $counter + 1; $total = $total + $res2[8]; $total1 = thour($total); } ?> <tr> <td><?php echo $cemploy; ?> </td><td><?php echo $block1; ?> </td><td><?php echo $shift1; ?> </td><td><?php echo $counter; ?>