H
Hello
Guest
This what the outcome should be: The correct counts are 8 orders with multiple copies, 13 copies of Linux, 23 copies of Macintosh, and 16 copies of Windows.
I am not getting anything - just the print out code, but no numbers nothing. This is what i get:
SOFTWARE ORDERS: REPORT
ORDERS FOR MULTIPLE COPIES: 0
LINUX COPIES ORDERED: 0
MACINTOSH COPIES ORDERED: 0
WINDOWS COPIES ORDERED: 0
Plus, I don't know if i am doing it right....can someone please give me some sugestions on how to make it more efficient? thanx! this is my code:
<html>
<head>
<title>Software2</title>
<link rel ="stylesheet" type="text/css" href="sample.css" />
</head>
<body>
<?php
$multipleOrders = 0;
$linuxCopies = 0;
$macintoshCopies = 0;
$windowsCopies = 0;
$orderFile = fopen("orders.txt", "r");
$nextOrder = fgets ($orderFile);
while (!feof($orderFile))
{
if ($nextOrder > 1)
{
$multipleOrders = $multipleOrders + $nextOrder;
$multipleOrders = $multipleOrders + 1;
}
elseif ($nextOrder == $linux)
{
$totalCopies = $totalCopies + $linuxCopies;
$totalOrders = $totalOrders + 1;
$nextOrder = fgets($orderFile);
}
elseif ($nextOrder == $macintosh)
{
$totalCopies = $totalCopies + $macintoshCopies;
$totalOrders = $totalOrders + 1;
$nextOrder = fgets($orderFile);
}
else ($nextOrder == $windows)
$totalCopies = $totalCopies + $windowsCopies;
$totalOrders = $totalOrders + 1;
$nextOrder = fgets($orderFile);
}
list($os, $numCopies) = split (":", $nextOrder);
}
fclose ($orderFile);
//end while
print ("<h1>SOFTWARE ORDERS: REPORT</h1>");
print ("<p>ORDERS FOR MULTIPLE COPIES: $multipleOrders</p>");
print ("<p>LINUX COPIES ORDERED: $linuxCopies</p>");
print ("<p>MACINTOSH COPIES ORDERED: $macintoshCopies</p>");
print ("<p>WINDOWS COPIES ORDERED: $windowsCopies</p>");
?>
</body>
</html>
Thanx in advanced!
well, I can do:
elseif ($nextOrder == $linuxCopies)
elseif ($nextOrder == $macintoshCopies)
elseif ($nextOrder == $windowsCopies)
all the variables above have been define to cero and still don't work.
ok elven_rangers, but how can I fix it? could you give an idea? I am new with all this...
I am not getting anything - just the print out code, but no numbers nothing. This is what i get:
SOFTWARE ORDERS: REPORT
ORDERS FOR MULTIPLE COPIES: 0
LINUX COPIES ORDERED: 0
MACINTOSH COPIES ORDERED: 0
WINDOWS COPIES ORDERED: 0
Plus, I don't know if i am doing it right....can someone please give me some sugestions on how to make it more efficient? thanx! this is my code:
<html>
<head>
<title>Software2</title>
<link rel ="stylesheet" type="text/css" href="sample.css" />
</head>
<body>
<?php
$multipleOrders = 0;
$linuxCopies = 0;
$macintoshCopies = 0;
$windowsCopies = 0;
$orderFile = fopen("orders.txt", "r");
$nextOrder = fgets ($orderFile);
while (!feof($orderFile))
{
if ($nextOrder > 1)
{
$multipleOrders = $multipleOrders + $nextOrder;
$multipleOrders = $multipleOrders + 1;
}
elseif ($nextOrder == $linux)
{
$totalCopies = $totalCopies + $linuxCopies;
$totalOrders = $totalOrders + 1;
$nextOrder = fgets($orderFile);
}
elseif ($nextOrder == $macintosh)
{
$totalCopies = $totalCopies + $macintoshCopies;
$totalOrders = $totalOrders + 1;
$nextOrder = fgets($orderFile);
}
else ($nextOrder == $windows)
$totalCopies = $totalCopies + $windowsCopies;
$totalOrders = $totalOrders + 1;
$nextOrder = fgets($orderFile);
}
list($os, $numCopies) = split (":", $nextOrder);
}
fclose ($orderFile);
//end while
print ("<h1>SOFTWARE ORDERS: REPORT</h1>");
print ("<p>ORDERS FOR MULTIPLE COPIES: $multipleOrders</p>");
print ("<p>LINUX COPIES ORDERED: $linuxCopies</p>");
print ("<p>MACINTOSH COPIES ORDERED: $macintoshCopies</p>");
print ("<p>WINDOWS COPIES ORDERED: $windowsCopies</p>");
?>
</body>
</html>
Thanx in advanced!
well, I can do:
elseif ($nextOrder == $linuxCopies)
elseif ($nextOrder == $macintoshCopies)
elseif ($nextOrder == $windowsCopies)
all the variables above have been define to cero and still don't work.
ok elven_rangers, but how can I fix it? could you give an idea? I am new with all this...