I'm trying to send multiple items in this email... i've tried a couple different ways and each way distorts it.
Take a look at the code below...
################################################################
//ADD ALL ITEMS FROM CART INTO DATABASE!
################################################################
//$tabel=$_SESSION['carttab'];
for ($i=0; $i<count($cartT); $i++) {
//$query2 = "SELECT * FROM product WHERE name='$pn1'";
$query2 = "SELECT * FROM product WHERE idproduct=" . $cartT[$i]["id"];
print($cartT[$i]["id"] . "<Br><br>");
//print("Product ID: " . $cartT[$i]["id"] . " -- Products Amount Ordered: " . $cartT[$i]["nr"] . "\r\n");
$pn = $cartT[$i]["id"];
$pi = $cartT[$i]["nr"];
$pon = "Product ID: " . $pn . " -- Products Amount Ordered: " . $pi . "\r\n";
mysql_connect($host, $user, $pass) or die(mysql_error());
mysql_select_db($dbase) or die(mysql_error());
$results = mysql_query($query2) or die(mysql_error());
$row = mysql_fetch_array($results) or die(mysql_error());
$pt = $row['price'];
if($row['inventory']>=$pi) {
$np = $row['inventory']-$pi;
} else {
$np = $row['inventory'];
}
mysql_select_db($dbase) or die(mysql_error());
mysql_query("UPDATE product SET inventory='$np' WHERE idproduct='$pn'")
or die(mysql_error());
mysql_select_db($dbase) or die(mysql_error());
mysql_query("INSERT INTO orderproduct (idorder, idproduct, items, price, outfromstock) VALUES('$id', '$pn', '$pi', '$pt', '$pi') ")
or die(mysql_error());
###################################################################
//END ADDING ITEMS TO DATABASE
###################################################################
#############################
//SEND MAIL
#############################
$to = 'brandon.ryall@loadedmedia.com';
$subject = 'New Products Ordered by PayPal';
$message = "Dear Admin,\r\n\nThe following Items were added to Order # $id\r\n\n ".$pon;
$headers = 'From: noreply@diabolikdvd.com' . "\r\n" .
'Reply-To: noreply@diabolikdvd.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
##############################
//END SEND MAIL
##############################
The best i have gotten is sending an email per item. Anybody have a suggestion?