Hi,
I'm am creating a timesheet for this company and wondering how to adding the total hours and display them on the sheet.
-------------------------------------------
This code extracts times * hours from dbase
-------------------------------------------
<body>
<center>
<h1>Timesheet</h1>
<?
$sql = "SELECT * from timesheet";
If ($Date)
$sql .= "Date like '%$Date%' and ";
If ($TimeIn1)
$sql .= "TimeIn1 like '%$TimeIn1%' and ";
If ($TimeOut1)
$sql .= "TimeOut1 like '%$TimeOut1%' and ";
If ($TimeIn2)
$sql .= "TimeIn2 like '%$TimeIn2%' and ";
If ($TimeOut2)
$sql .= "TimeOut2 like '%$TimeOut2%' and ";
If ($Tot_hrs_day)
$sql .= "Tot_hrs_day like '%$Tot_hrs_day%' and ";
$connection = mysql_connect("localhost","univrel","univrel") or die ("Couldn't connect to server.");
$db = mysql_select_db("univrel",$connection) or die ("Couldn't connect to database.");
$sql_result = mysql_query($sql,$connection);
?>
<a href=http://www.phpbuilder.com/board/archive/index.php/"log_hours.php3">Click here for Time Login Page</a>
<br><br>
<table border="1" cellspacing="5" cellpadding="3">
<tr>
<td align="center"><b>Date:</b></td>
<td align="center"><b>Time In:</b></td>
<td align="center"><b>Time Out:</b></td>
<td align="center"><b>Time In:</b></td>
<td align="center"><b>Time Out:</b></td>
<td align="center"><b>Total Hours Of the Day:</b></td>
<td align="center"><b>Modify:</b></td>
</tr>
<?
while (($row = mysql_fetch_object($sql_result)))
{
printf("<tr>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td><a href=\"msheet.php3?rowid=%s\"><I>Modify</I></a></td>
</tr>\n", $row->Date, $row->TimeIn1, $row->TimeOut1, $row->TimeIn2, $row->TimeOut2, $row->Tot_hrs_day, $row->rowid);
}
printf("</table>\n");
mysql_free_result($sql_result);
?>
<br>
<b>Enter Total hours of Pay Period:</b><input type="integer" name="Tot_hrs_pp" size=5>
</form>
</center>
</body>
At the'Enter Total hours of Pay Period' box i want to display the calculated Total Hours of the Day of all rows. How can i go about that???
I'm am creating a timesheet for this company and wondering how to adding the total hours and display them on the sheet.
-------------------------------------------
This code extracts times * hours from dbase
-------------------------------------------
<body>
<center>
<h1>Timesheet</h1>
<?
$sql = "SELECT * from timesheet";
If ($Date)
$sql .= "Date like '%$Date%' and ";
If ($TimeIn1)
$sql .= "TimeIn1 like '%$TimeIn1%' and ";
If ($TimeOut1)
$sql .= "TimeOut1 like '%$TimeOut1%' and ";
If ($TimeIn2)
$sql .= "TimeIn2 like '%$TimeIn2%' and ";
If ($TimeOut2)
$sql .= "TimeOut2 like '%$TimeOut2%' and ";
If ($Tot_hrs_day)
$sql .= "Tot_hrs_day like '%$Tot_hrs_day%' and ";
$connection = mysql_connect("localhost","univrel","univrel") or die ("Couldn't connect to server.");
$db = mysql_select_db("univrel",$connection) or die ("Couldn't connect to database.");
$sql_result = mysql_query($sql,$connection);
?>
<a href=http://www.phpbuilder.com/board/archive/index.php/"log_hours.php3">Click here for Time Login Page</a>
<br><br>
<table border="1" cellspacing="5" cellpadding="3">
<tr>
<td align="center"><b>Date:</b></td>
<td align="center"><b>Time In:</b></td>
<td align="center"><b>Time Out:</b></td>
<td align="center"><b>Time In:</b></td>
<td align="center"><b>Time Out:</b></td>
<td align="center"><b>Total Hours Of the Day:</b></td>
<td align="center"><b>Modify:</b></td>
</tr>
<?
while (($row = mysql_fetch_object($sql_result)))
{
printf("<tr>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td><a href=\"msheet.php3?rowid=%s\"><I>Modify</I></a></td>
</tr>\n", $row->Date, $row->TimeIn1, $row->TimeOut1, $row->TimeIn2, $row->TimeOut2, $row->Tot_hrs_day, $row->rowid);
}
printf("</table>\n");
mysql_free_result($sql_result);
?>
<br>
<b>Enter Total hours of Pay Period:</b><input type="integer" name="Tot_hrs_pp" size=5>
</form>
</center>
</body>
At the'Enter Total hours of Pay Period' box i want to display the calculated Total Hours of the Day of all rows. How can i go about that???