holladb Posted November 1, 2007 Share Posted November 1, 2007 Im having difficulties getting this mail function to send all the content in a shopping cart. Here is the code: ################################################################ //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 = '[email protected]'; $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: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); ############################## //END SEND MAIL ############################## } mail($to, $subject, $message, $headers); i have tried multiple ways, the way above sends each product as a single email. any solutions? Link to comment https://forums.phpfreaks.com/topic/75672-solved-send-mail-troubles/ Share on other sites More sharing options...
holladb Posted November 1, 2007 Author Share Posted November 1, 2007 anybody ??????? Link to comment https://forums.phpfreaks.com/topic/75672-solved-send-mail-troubles/#findComment-382946 Share on other sites More sharing options...
teng84 Posted November 1, 2007 Share Posted November 1, 2007 use dot equal (.=) not just = eg.. $pon .= "Product ID: " . $pn . " -- Products Amount Ordered: " . $pi . "\r\n"; Link to comment https://forums.phpfreaks.com/topic/75672-solved-send-mail-troubles/#findComment-383072 Share on other sites More sharing options...
holladb Posted November 2, 2007 Author Share Posted November 2, 2007 thanks teng, i didn't even notice that i appreciate it! Link to comment https://forums.phpfreaks.com/topic/75672-solved-send-mail-troubles/#findComment-383469 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.