|
 |
|
รบกวนถาม syntax ส่งเมลจากตะกร้าสินค้าค่ะ เอาโค้ดเรื่องหารส่งเมลมาใช้ พอลองคิวรี้ข้อมูลจากดาต้าเบสไม่ได้ค่ะ |
|
 |
|
|
 |
 |
|
Code (PHP)
$strMessage = "
<h1>My Message</h1><br>
<table width='285' border='1'> ";
$sql_show = "select subject from new "; //new_id DESC
$result_show = mysql_query($sql_show) or die(mysql_error());
while($row_show = mysql_fetch_array($result_show))
{
$strMessage=."<tr>
<td><div align='center'><strong><?=$row_show['subject']?> </strong></div></td>
<td><div align='center'><font color='red'>My Message</font></div></td>
<td><div align='center'><font size='2'>My Message</font></div></td>
</tr>
<tr>
<td><div align='center'>My Message</div></td>
<td><div align='center'>My Message</div></td>
<td><div align='center'>My Message</div></td>
</tr>
<tr>
<td><div align='center'>".$strVar."</div></td>
<td><div align='center'>".$strVar."</div></td>
<td><div align='center'>".$strVar."</div></td>
</tr>";
<?
}
?>
$strMessage=."</table>";
$flgSend = @mail($strTo,$strSubject,$strMessage,$strHeader); // @ = No Show Error //
if($flgSend)
{
echo "Email Sending.";
}
else
{
echo "Email Can Not Send.";
}
น่าจะแบบนี้ครับ
|
 |
 |
 |
 |
Date :
2011-10-30 19:26:44 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากนะค่ะ ลองเอาไปเทสแล้วค่ะ error syntax ตรง <?=$row_show['subject']?> ค่ะ
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
พอเอา <?=$row_show['subject']?> จะส่งเมลได้ค่ะ ข้อมูลที่ส่งไปจะมีจำนวนแถวเท่ากับข้อมูลที่คิวรี่ขึ้นมาพอดีเลยค่ะ
จะแก้ยังไงดีค่ะ
|
 |
 |
 |
 |
Date :
2011-10-30 20:45:00 |
By :
kampong23 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
รอบคอบหน่อยครับ เขียนเปิดปิดแล้วคอยแทรกโค๊ดจะได้ไม่เปิดปิดผิดอีกนะ
$strMessage = "
<h1>My Message</h1><br>
<table width='285' border='1'> ";
$sql_show = "select subject from new "; //new_id DESC
$result_show = mysql_query($sql_show) or die(mysql_error());
while($row_show = mysql_fetch_array($result_show))
{
$strMessage=."<tr>
<td><div align='center'><strong>".$row_show['subject']."</strong></div></td>
<td><div align='center'><font color='red'>My Message</font></div></td>
<td><div align='center'><font size='2'>My Message</font></div></td>
</tr>
<tr>
<td><div align='center'>My Message</div></td>
<td><div align='center'>My Message</div></td>
<td><div align='center'>My Message</div></td>
</tr>
<tr>
<td><div align='center'>".$strVar."</div></td>
<td><div align='center'>".$strVar."</div></td>
<td><div align='center'>".$strVar."</div></td>
</tr>";
<?
}
?>
$strMessage=."</table>";
$flgSend = @mail($strTo,$strSubject,$strMessage,$strHeader); // @ = No Show Error //
if($flgSend)
{
echo "Email Sending.";
}
else
{
echo "Email Can Not Send.";
}
|
ประวัติการแก้ไข 2011-10-30 21:45:09
 |
 |
 |
 |
Date :
2011-10-30 21:44:26 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณพี่ วินและพี่ PlaKriM มากเลยนะค่ะที่แนะนำ ทำได้แล้วค่ะ จะเอาไปพัฒนาต่อนะค่ะ
|
 |
 |
 |
 |
Date :
2011-10-31 12:26:59 |
By :
kampong23 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|