Saturday 15 August 2015

php - Looping content in email body -



php - Looping content in email body -

i want loop contents in email body, don't know how that. :d please help. :(

<?php $db_username = 'ads'; $db_password = 'sad'; $db_name = 'asdasd'; $db_host = 'asd.com'; $mysqli = new mysqli($db_host, $db_username, $db_password,$db_name); ?> $results = $mysqli->query("select * products order id asc"); foreach( mysql_fetch_array($results) $item ) { $message = '<html> <head> <title>from our company</title> </head> <body> <div id="newsletter-product" style="border:1px solid gray; overflow:hidden; width:500px; margin:0 auto; text-align:center;"> //i want loop div// <div id="newsletter-organic" style="float:left; width:50%;"> <h1> organik </h1> <p><img src="http:mywebsite/images/'.$item['product_img_name'].'" width:150px; height:200px;"></p> <a href="http://mywebsite.com/get-referal.php?referal_identity='.$referal_identity.'&referal_address='.$referal_address.'&productname='.$item['product_name'].'"> <p>beras putih</p></a><br/> </div> </div> </body> </html>'; }

what going loop there products.

thanks helping me this. :)

try this

<?php $db_username = 'ads'; $db_password = 'sad'; $db_name = 'asdasd'; $db_host = 'asd.com'; $con = mysqli_connect($db_host, $db_username, $db_password,$db_name); $results = mysqli_query($con,"select * products order id asc"); $message=''; while( $item=mysqli_fetch_array($con,$results) ) { $message. = '<html> <head> <title>from our company</title> </head> <body> <div id="newsletter-product" style="border:1px solid gray; overflow:hidden; width:500px; margin:0 auto; text-align:center;"> //i want loop div// <div id="newsletter-organic" style="float:left; width:50%;"> <h1> organik </h1> <p><img src="http:mywebsite/images/'.$item['product_img_name'].'" width:150px; height:200px;"></p> <a href="http://mywebsite.com/get-referal.php?referal_identity='.$referal_identity.'&referal_address='.$referal_address.'&productname='.$item['product_name'].'"> <p>beras putih</p></a><br/> </div> </div> </body> </html>'; }

php html sql

No comments:

Post a Comment