n00bert Posted January 8, 2010 Share Posted January 8, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/187656-php-mysql-concat-display-rows-email/ Share on other sites More sharing options...
trq Posted January 8, 2010 Share Posted January 8, 2010 Have you tried debugging your query? Quote Link to comment https://forums.phpfreaks.com/topic/187656-php-mysql-concat-display-rows-email/#findComment-990722 Share on other sites More sharing options...
n00bert Posted January 8, 2010 Author Share Posted January 8, 2010 yeah, the query works fine... it just seems like it's not concatenating the $strMainbody for that area... idk Quote Link to comment https://forums.phpfreaks.com/topic/187656-php-mysql-concat-display-rows-email/#findComment-990728 Share on other sites More sharing options...
n00bert Posted January 8, 2010 Author Share Posted January 8, 2010 I'm an idiot... I just noticed I had this running a few lines above all my other code mysql_query("UPDATE ushits_orders SET customer_id='".mysql_insert_id()."', session_id = '0' WHERE session_id='".$session."' "); Sorry I wasted your time guys. Quote Link to comment https://forums.phpfreaks.com/topic/187656-php-mysql-concat-display-rows-email/#findComment-990742 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.