|
|
|
รบกวนสอบถามหน่อยค่ะ พอดีต้องการเขียนส่ง email โดยการวน loop while ข้อมูลอ่ะคะ |
|
|
|
|
|
|
|
Code (PHP)
<?php
include ("config.php");
$date = date('Y-m-d');
// SQL สรุปยอดส่งเมล์
$sql = "SELECT * FROM view_stock order by product_name";
//print $sql."<br>/";
$message = "";
$res = mysql_query($sql);
while($row = mysql_fetch_array($res)){
$item_id = $row['item_id'];
$product_name = $row['product_name'];
$total_instock = $row['total_instock'];
$message .= "$item_id $product_name $total_instock <br>";
}
/*echo "ID :".$item_id."<br>";
echo "Name :".$product_name."<br>";
echo "Total :".$total_instock."<br>";*/
$to = "[email protected]";
$subject = "STOCK";
$headers .= "CC:[email protected]";
$message .= "Update STOCK :".$date. "\r\n";
$message .= "\r\n";
$message .= $product_name." : ".$total_instock ;
mail($to,$subject,$message,$headers);
?>
ประมาณนี้ครับ
|
|
|
|
|
Date :
2015-08-18 09:31:55 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|