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 = '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 ############################## } mail($to, $subject, $message, $headers); i have tried multiple ways, the way above sends each product as a single email. any solutions? Quote 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 ??????? Quote 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"; Quote 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! Quote Link to comment https://forums.phpfreaks.com/topic/75672-solved-send-mail-troubles/#findComment-383469 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.