Jump to content

[SOLVED] Send Mail Troubles...


holladb

Recommended Posts

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.