goop
11-22-2011, 10:51 PM
Could some one help me with the following?
.txt file contains:
236.00
284.00
148.00
128.00
0.00
110.00
0.00
php that needs to be amended:
<html>
<head>
<title>Weekly Report</title>
<link rel ="stylesheet" type="text/css" href="sample.css" />
</head>
<body>
<h1>Weekly Report</h1>
<?php
$paintFile = fopen("weeklyData.txt","r");
print("<p>TOTAL INCOME FROM PAINT CONTRACTS: ");
print("$".number_format($total, 2)."</p>");
print("<p>AVG DAILY INCOME FROM PAINT CONTRACTS: ");
print("$".number_format($avgDailyIncome, 2)."</p>");
print("<p>NUMBER OF DAYS with NO INCOME: $badDays.</p>");
?>
</body>
</html>
I need to amend this php to use a FOR loop to read the 7 lines from the file and add the total income, the average income and the number of days with no income. Can anyone help me on this? I am soooo lost! Thanks!
.txt file contains:
236.00
284.00
148.00
128.00
0.00
110.00
0.00
php that needs to be amended:
<html>
<head>
<title>Weekly Report</title>
<link rel ="stylesheet" type="text/css" href="sample.css" />
</head>
<body>
<h1>Weekly Report</h1>
<?php
$paintFile = fopen("weeklyData.txt","r");
print("<p>TOTAL INCOME FROM PAINT CONTRACTS: ");
print("$".number_format($total, 2)."</p>");
print("<p>AVG DAILY INCOME FROM PAINT CONTRACTS: ");
print("$".number_format($avgDailyIncome, 2)."</p>");
print("<p>NUMBER OF DAYS with NO INCOME: $badDays.</p>");
?>
</body>
</html>
I need to amend this php to use a FOR loop to read the 7 lines from the file and add the total income, the average income and the number of days with no income. Can anyone help me on this? I am soooo lost! Thanks!