cdoggg94 Posted August 29, 2012 Share Posted August 29, 2012 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! Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 29, 2012 Share Posted August 29, 2012 ".} while ($row_AllWine = mysql_fetch_assoc($AllWine));." //this is the end of the repeat region. You can't do that. You got a syntax error, in the future you need to post your errors (after reading them) Quote Link to comment Share on other sites More sharing options...
cdoggg94 Posted August 29, 2012 Author Share Posted August 29, 2012 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." Quote Link to comment Share on other sites More sharing options...
cdoggg94 Posted August 29, 2012 Author Share Posted August 29, 2012 so its obviously a huge mistake to have those 2 lines in there...im just not sure why. Maybe i have been looking at it for to long.. Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 29, 2012 Share Posted August 29, 2012 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); Quote Link to comment Share on other sites More sharing options...
cdoggg94 Posted August 29, 2012 Author Share Posted August 29, 2012 in my case then would $str = $message? since i want to repeat something in that string ? Quote Link to comment 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.