Jump to content

Repeating a region - in an email script


cdoggg94

Recommended Posts

Attached is an image of a pages content.  It shows all products that a specific client has ordered.

 

I have got this by making a recordset in dreamweaver named "AllWine"

 

Then for all of them to show I have used the "Repeat Region" server behavior in dreamweaver.

 

in the back ground of this page it also emails the information to people so they can view it.

 

my problem is that I can only display the first product and its information..

 

When I write the repeat region information in the code it just says sintax error.

 

this is the code (without the repeating region):

 

<?php 

//-------------email section----------------//

$productName = $row_AllWine['wish_client'];
$unitPrice = "$".number_format(($row_AllWine['wish_bottle'])/($row_AllWine['wish_case']), 2);
$proQty = $row_AllWine['wish_case'];
$customer = $row_AllWine['wish_product'];
$grandTotal = $_GET['Total'];
$unitTotal = $row_AllWine['wish_bottle'];
$thisClient = $_GET['FinOrder'];


$to = "email@gmail.com";
$subject = "New Order";

$message = "
<html>
<head>
<title>New Order</title>


</head>
<body>

<div align='center'>
<img src='http://website.com/images/header.jpg' />
<br />
Client Name: ".$thisClient."<br /><br />
<table border='0' width='500'>

<tr>
<th width='125' align='left'>Product</th>
<th width='125' align='center'>Unit Price</th>
<th width='125' align='center'>Qty</th>
<th width='125' align='right'>Total</th>
</tr>	


<tr>
<td align='left'>".$productName."</td>
<td align='center'>".$unitPrice."</td>
<td align='center'>".$proQty."</td>
<td align='right'>$".number_format($unitTotal, 2)."</td>	
</tr>

<tr>
	<td colspan='4' align='right'>Grand Total = ".$grandTotal."</td>
</tr>

</table>
  


</div>
</body>
</html>
";

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";


$headers .= 'From: <email@hotmail.com>'. "\r\n";


mail($to,$subject,$message,$headers);


?>

 

and i thought that something like this would repeat the information and show all of the records for that person in the email.  Im just not sure which part is causing the sintax error

 

<?php 

//-------------email section----------------//

$productName = $row_AllWine['wish_client'];
$unitPrice = "$".number_format(($row_AllWine['wish_bottle'])/($row_AllWine['wish_case']), 2);
$proQty = $row_AllWine['wish_case'];
$customer = $row_AllWine['wish_product'];
$grandTotal = $_GET['Total'];
$unitTotal = $row_AllWine['wish_bottle'];
$thisClient = $_GET['FinOrder'];


$to = "email@gmail.com";
$subject = "New Order";

$message = "
<html>
<head>
<title>New Order</title>


</head>
<body>

<div align='center'>
<img src='http://website.com/images/header.jpg' />
<br />
Client Name: ".$thisClient."<br /><br />
<table border='0' width='500'>

<tr>
<th width='125' align='left'>Product</th>
<th width='125' align='center'>Unit Price</th>
<th width='125' align='center'>Qty</th>
<th width='125' align='right'>Total</th>
</tr>	

".do {."    //this is the start of the repeat region
<tr>
<td align='left'>".$productName."</td>
<td align='center'>".$unitPrice."</td>
<td align='center'>".$proQty."</td>
<td align='right'>$".number_format($unitTotal, 2)."</td>	
</tr>
".} while ($row_AllWine = mysql_fetch_assoc($AllWine));." //this is the end of the repeat region.

<tr>
	<td colspan='4' align='right'>Grand Total = ".$grandTotal."</td>
</tr>

</table>
  


</div>
</body>
</html>
";

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";


$headers .= 'From: <email@hotmail.com>'. "\r\n";


mail($to,$subject,$message,$headers);


?>

 

its probably something right in front of me but i cant seem to see it.

 

if anyone has any ideas it would be great

 

thanks!

post-110186-13482403734123_thumb.jpg

Link to comment
Share on other sites

I wish I could tell you what the error says, but dreamweaver only says syntax error and when I test in a browser with error_reporting(-1) there is this error of the page: "HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request."

 

 

Link to comment
Share on other sites

You cannot have a do while block actually within a string. You are trying to concat a control structure to a string, rather than a string to a string.

You can concat the contents of the block WITHIN it.

$x = 1;
$str = "test";
do{
   $str .= $x;
    $x++;
}while($x<10);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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