Thanks for replying back.
Yeah, I understand the math functions but what i'm stuck on is how to incorporate the addition function in php3/sql to the fields of the database the numbers pertains too for calculating the total number and to extract that total number from the database to display on the html page.
Take a look:
// View Time page code:
<body>
<center>
<h1>Timesheet</h1>
<?
$sql = "SELECT * from sheet";
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="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>
// Page displayed: If you cant understand this page clearly go to http://www.ur.msu.edu/workshop/artice/vsheet.php3 and you will see what's going on and what i'm trying to do!
Timesheet
Click here for Time Login Page
Date: Time In: Time Out: Time In: Time Out: Total Hours Of the Day: Modify:
2000-12-17 03:22:00 01:11:00 00:00:00 00:00:00 10.6000 Modify
2000-12-17 06:12:00 02:23:00 00:00:00 00:00:00 4.0000 Modify
Enter Total hours of Pay Period:
My comments:
At the 'Enter Total hours of Pay Period:' box i would like to have calculated the Total Hours of the Day(The '10.6+4.0') extracted from the database. How do i code the calculation and to retrieve the total from mysql database in php3?? I tried using a rowid but that doesn't work!!