Jump to content

PHP MYSQL CONCAT DISPLAY ROWS EMAIL


n00bert

Recommended Posts

Yes, I  know the subject for this thread is horrible but didn't really know how to sum it up. XD

 

anyway what I am doing here is sending an email invoice to customers..

The problem is that the emails don't contain any products.

 

Here is that section of code for the script.

<?php
$strMailbody = "<table width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin:0 auto;\">
  <tr>
    <td><strong>Billing Information</strong></td>
    <td><strong>Shipping Information</strong></td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td>".$_POST['first_name']." ".$_POST['last_name']."</td>
    <td>".$_POST['sfirst_name']." ".$_POST['slast_name']."</td>
  </tr>
  <tr>
    <td>".$_POST['address']."</td>
    <td>".$_POST['saddress']."</td>
  </tr>
  <tr>
    <td>".$_POST['city'].", ".$_POST['state']."</td>
    <td>".$_POST['scity'].", ".$_POST['sstate']."</td>
  </tr>
  <tr>
    <td>".$_POST['postal']."</td>
    <td>".$_POST['spostal']."</td>
  </tr>
  <tr>
    <td>".$_POST['country']."</td>
    <td>".$_POST['scountry']."</td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td><strong>Home Phone:</strong>".format_phone($_POST['hphone'])."</td>
    <td> </td>
  </tr>
  <tr>
    <td><strong>Cell Phone:</strong>".format_phone($_POST['cphone'])."</td>
    <td> </td>
  </tr>
  <tr>
    <td><strong>Email:</strong>".$_POST['email']."</td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
</table>
<table width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin:0 auto; padding-top:20px;\">
  <tr>
    <td align=\"center\"><strong>Item</strong></td>
    <td align=\"center\"><strong>Product Name</strong></td>
    <td align=\"center\"><strong>Dimensions</strong></td>
    <td align=\"center\"><strong>Price</strong></td>
  </tr>";
  
$cart = mysql_query("SELECT * FROM ushits_orders, ushits_products, ushits_packages
						WHERE ushits_orders.package_id = ushits_packages.package_id
						AND ushits_packages.package_product_id = ushits_products.product_id
						AND ushits_orders.session_id = '".session_id()."'
						AND ushits_orders.order_step = '1'");
while($row2 = mysql_fetch_assoc($cart)){
$strMailbody .= "<tr>
    <td align=\"center\"><a href=\"http://www.u-shits.com/beta1/images/customer_images/".$row2['image']."\"><img src=\"http://www.u-shits.com/beta1/images/customer_images/tb_".$row2['image']."\" /></a></td>
    <td align=\"center\">".$row2['product_name']." (".$row2['package_name'].")"."</td>
    <td align=\"center\">".$row2['dimensions']."</td>
    <td align=\"center\">".$row2['package_price']."</td>
  </tr>";
}
$strMailbody .= "</table>";
$strFrom = "[email protected]";
$strTo = $_POST['email'];
$strSub = "Your u-shits Invoice";
mail($strTo,$strSub,$strMailbody,"From:$strFrom\r\nReply-to: $strFrom\r\nContent-type: text/html; charset=us-ascii");
?>

 

here is the code that's not working

 

$cart = mysql_query("SELECT * FROM ushits_orders, ushits_products, ushits_packages
						WHERE ushits_orders.package_id = ushits_packages.package_id
						AND ushits_packages.package_product_id = ushits_products.product_id
						AND ushits_orders.session_id = '".session_id()."'
						AND ushits_orders.order_step = '1'");
while($row2 = mysql_fetch_assoc($cart)){
$strMailbody .= "<tr>
    <td align=\"center\"><a href=\"http://www.u-shits.com/beta1/images/customer_images/".$row2['image']."\"><img src=\"http://www.u-shits.com/beta1/images/customer_images/tb_".$row2['image']."\" /></a></td>
    <td align=\"center\">".$row2['product_name']." (".$row2['package_name'].")"."</td>
    <td align=\"center\">".$row2['dimensions']."</td>
    <td align=\"center\">".$row2['package_price']."</td>
  </tr>";
}

 

that piece of code is not displayed in my emails..

 

any ideas?

Link to comment
https://forums.phpfreaks.com/topic/187656-php-mysql-concat-display-rows-email/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.