Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to email orders to customer in php
    primarykey
    data
    text
    <p>this is an edit and i have inserted below the updated code requested by nav.</p> <p>Products Not Being Emailed To Customers Email. I have tried everything but cannot find the solution.</p> <pre><code> &lt;? include("includes/db.php"); include("includes/functions.php"); $max=count($_SESSION['cart']); for($i=0;$i&lt;$max;$i++){ $pid=$_SESSION['cart'][$i]['productid']; $q=$_SESSION['cart'][$i]['qty']; $price=get_price($pid); $date=date('Y/m/d'); $user=$_SESSION['username']; $pname=get_product_name($pid); mysql_query("insert into `order` values ('','$pname','$q','$price','$date','$user')") or die(mysql_error()); } die('Thank You! your order has been placed! &lt;br/&gt; &lt;a href="login/order.php"&gt;Home&lt;/a&gt;'); /*session_unset(); */ session_unset($_SESSION['cart']); session_destroy($_SESSION['cart']); ?&gt; &lt;?php $con = mysql_connect("localhost","*****","*******"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db('********', $con); $sql="SELECT * FROM customers WHERE username = '".$_SESSION['username']."'";//"CUSTOMERS ID" = the customer who you would like to email, their id from the DB $q=mysql_query($sql,$con); $r=mysql_fetch_array($q); $messege = "Hi $user, &lt;br/&gt;&lt;br/&gt; You Have Ordered The Following Items on $date :&lt;br/&gt; &lt;br/&gt;$pname &lt;br/&gt; $q &lt;br/&gt; $price "; $to= $r['email']; $from = 'order@musicinc.com'; $subject="Your Order Has Been Placed"; mail($to,$subject,$messege,$from); ?&gt; </code></pre> <p>i tried without the db query and inserted in my gmail but to no success at all.</p> <p><em><strong>EDITED</em></strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload