A
Anonymous
Guest
Hi guys,
I tried to send these info to my mailbox by using mail function... but i can't get the value for the totalCost in my email.. (I can get the others)
can you guys check whats wrong with my code ??
my code:
if($_SESSION['mem'] == "assc")
{
while($row = mysql_fetch_array($result))
{
$totalCost += ($row["qty"] * $row["associate"]);
$contents .="Item: {$row['itemName']}\n";
$contents .="Name: {$row['itemDesc']}\n";
$contents .="Price per item: USD";
$contents .= number_format($row['associate'], 2,'.', '.') . "\n";
$contents .="Quantity: {$row['qty']}\n";
}
$contents .="Total amount: USD {$totalCost} \n";
}
elseif ($_SESSION['mem'] == "dist")
{
while($row = mysql_fetch_array($result))
{
$totalCost += ($row["qty"] * $row["distributor"]);
$contents .="Item: {$row['itemName']}\n";
$contents .="Name: {$row['itemDesc']}\n";
$contents .="Price per item: USD";
$contents .= number_format($row['associate'], 2,'.', '.') . "\n";
$contents .="Quantity: {$row['qty']}\n";
}
$contents .="Total amount: USD {$totalCost} \n";
}
else
{
while($row = mysql_fetch_array($result))
{
$contents .="Item: {$row['itemName']}\n";
$contents .="Name: {$row['itemDesc']}\n";
$contents .="Price per item: USD";
$contents .= number_format($row['associate'], 2,'.', '.') . "\n";
$contents .="Quantity: {$row['qty']}\n";
}
$contents .="Total amount: USD {$totalCost} \n";
}
--- mail function ()
PLease advise.
I tried to send these info to my mailbox by using mail function... but i can't get the value for the totalCost in my email.. (I can get the others)
can you guys check whats wrong with my code ??
my code:
if($_SESSION['mem'] == "assc")
{
while($row = mysql_fetch_array($result))
{
$totalCost += ($row["qty"] * $row["associate"]);
$contents .="Item: {$row['itemName']}\n";
$contents .="Name: {$row['itemDesc']}\n";
$contents .="Price per item: USD";
$contents .= number_format($row['associate'], 2,'.', '.') . "\n";
$contents .="Quantity: {$row['qty']}\n";
}
$contents .="Total amount: USD {$totalCost} \n";
}
elseif ($_SESSION['mem'] == "dist")
{
while($row = mysql_fetch_array($result))
{
$totalCost += ($row["qty"] * $row["distributor"]);
$contents .="Item: {$row['itemName']}\n";
$contents .="Name: {$row['itemDesc']}\n";
$contents .="Price per item: USD";
$contents .= number_format($row['associate'], 2,'.', '.') . "\n";
$contents .="Quantity: {$row['qty']}\n";
}
$contents .="Total amount: USD {$totalCost} \n";
}
else
{
while($row = mysql_fetch_array($result))
{
$contents .="Item: {$row['itemName']}\n";
$contents .="Name: {$row['itemDesc']}\n";
$contents .="Price per item: USD";
$contents .= number_format($row['associate'], 2,'.', '.') . "\n";
$contents .="Quantity: {$row['qty']}\n";
}
$contents .="Total amount: USD {$totalCost} \n";
}
--- mail function ()
PLease advise.