mickstacey Posted July 22, 2007 Share Posted July 22, 2007 Hi, Can anyone help.....I am getting the following error on my website but can't fix it. Parse error: syntax error, unexpected T_STRING in /home/shitsti/public_html/payment_complete.php on line 24 Line 24 reads; $email = "clivestix@btinternet.com"; appreciate any help Quote Link to comment Share on other sites More sharing options...
LiamProductions Posted July 22, 2007 Share Posted July 22, 2007 Post some more code. That normally hints where around the error is. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 22, 2007 Share Posted July 22, 2007 Well, unless im being blind theres absolutely nothing wrong with that line. Are you sure thats the correct line? Can you post the few lines surrounding it? I would suggest its a missing semi colon from the previous line, but then you'd get unexpected variable. Quote Link to comment Share on other sites More sharing options...
mickstacey Posted July 22, 2007 Author Share Posted July 22, 2007 Thanks for the quick replies guys. The entire page of code is; <?php include 'header.php'; $account = mysql_query("SELECT * FROM customers WHERE username='$_SESSION[username]' AND password='$_SESSION[password]'") or die(mysql_error()); $account = mysql_fetch_array($account); $date = date("Y-m-d"); $orders = mysql_query("SELECt * FROM orders WHERE order_date='$date' ORDER BY complete_id DESC LIMIT 1") or die(mysql_error()); $lastorder = mysql_fetch_array($orders); $lastorder = $lastorder[complete_id]; $next_order = $lastorder + 1; mysql_query("UPDATE orders SET cust_id='$account[id]', order_date='$date', complete_id='$next_order', status='payment complete' WHERE id='$_SESSION[order_id]'") or die(mysql_error()); $order_name = date("d").'-'.date("m").'-'.$next_order; $email_title = "Shitstix Order Confirmation"; $email_content = " Dear ".$account['firstname'].",<br><br> <p>Thank you for your recent order at Shitstix.co.uk. We are emailing you to let you know that we are currently processing your order and will post your order out to you within the next few days. If you have any questions regarding your order, please feel free to email us at clivestix@btinternet.com.</p> <p>Thank You</p> Shitstix Team ; $email = "clivestix@btinternet.com"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: ' . $email."\r\n" . 'Reply-To: '. $email."\r\n"; mail($account['email'],$email_title,$email_content,$headers); /* $prod_array = Array(); $order_products = mysql_query("SELECT * FROM order_log WHERE order_id='$_SESSION[order_id]' ORDER BY product_id") or die(mysql_error()); $numrows = mysql_num_rows($order_products); while($order_product = mysql_fetch_array($order_products)){ if(in_array($order_product[product_id],$prod_array) == FALSE){ $prod_array[] = $order_product[product_id]; $product_count = mysql_query("SELECT * FROM order_log WHERE order_id='$_SESSION[order_id]' AND product_id='$order_product[product_id]'") or die(mysql_error()); $product_count = mysql_num_rows($product_count); $product_det = mysql_query("SELECT * FROM products WHERE id='$order_product[product_id]'") or die(mysql_error()); $product_det = mysql_fetch_array($product_det); $orderlog = $orderlog . $product_count.' - ' .$product_det['name'].'<br>'; } } $email_title = "Shitstix Order"; $email_content = " The following order needs to be processed and posted to: ".$order_name."<br> ".$account['name']." ".$account['surname']."<br> ".$account['addline1']."<br> ".$account['addline2']."<br> ".$account['addline3']."<br> ".$account['addline4']."<br><br> Order Details:<br><br> ".$orderlog." "; */ $content = " <div style='font-family: arial; font-size: 14px;'> <div style='width: 100%; border-bottom: 2px solid #000; padding: 10px; text-align: center; font-family: Comic Sans MS;'><h1>Shitstix.co.uk</h1></div> <h2 style='font-size: 16px;'>Shitstix Order: ".$order_name."</h2> <div style='border: 1px solid #000; padding: 5px;'> <b>Customer:</b><br><br><br><br> ".$account['firstname']." ".$account['surname']."<br> ".$account['addline1']."<br> ".$account['addline2']."<br> ".$account['addline3']."<br> ".$account['postcode']." </div> <br><br><br><br> Dear ".$account[firstname].", <p>Thank you for ordering from Shitstix.co.uk. We have enclosed your order along with this invoice.</p> Best Regards,<br><br> Shitstix Team<br><br><br> <center> <table border=0 cellpadding=0 cellspacing=0 style='width: 100%; font-family: arial; font-size: 11px;'> <tr> <td colspan=2 style='border-bottom: 1px solid #C2C2C1; text-align: left;'>Item</td> <td style='border-bottom: 1px solid #C2C2C1; text-align: left;'>Quantity</td> </tr>"; $total = 0; $price_total = 0; $prod_array = Array(); $groups = mysql_query("SELECT * FROM groups ORDER BY id") or die(mysql_query()); while($group = mysql_fetch_array($groups)){ $content = $content." <tr> <td colspan=3 style='font-weight: bold; text-align: left;'><h2 style='color: #000000;font-size: 14px;'>".$group['name']."</h2></td> </tr>"; $order_products = mysql_query("SELECT * FROM order_log WHERE order_id='$_SESSION[order_id]' AND group_id='$group[id]' ORDER BY product_id") or die(mysql_error()); $numrows = mysql_num_rows($order_products); if($numrows > 0){ while($order_product = mysql_fetch_array($order_products)){ if(in_array($order_product[product_id],$prod_array) == FALSE){ $prod_array[] = $order_product[product_id]; $product_count = mysql_query("SELECT * FROM order_log WHERE order_id='$_SESSION[order_id]' AND product_id='$order_product[product_id]'") or die(mysql_error()); $product_count = mysql_num_rows($product_count); $product_det = mysql_query("SELECT * FROM products WHERE id='$order_product[product_id]'") or die(mysql_error()); $product_det = mysql_fetch_array($product_det); $content = $content ." <tr> <td width=1% style='border-top: 1px solid #e7e7e7; border-bottom: #e7e7e7;'></td> <td style='border-top: 1px solid #e7e7e7; border-bottom: #e7e7e7; text-align: left;'>".$product_det['name']." </td> <td style='border-top: 1px solid #e7e7e7; border-bottom: #e7e7e7; text-align: right;'>".$product_count."</td> </tr>"; $total = $total + $product_count; $price_total = $price_total + ($product_det[price] * $product_count); }else{ $content = $content." <tr> <td colspan=3 style='text-align: center;'>".$group['name']."s</td> </tr>"; } } } } $content = $content . " <tr> <td colspan=2 style='border-top: 1px solid #C2C2C1; text-align: right;' width=90%>Total Items:</td> <td style='border-top: 1px solid #C2C2C1; text-align: right;'> ".$total."</td> </tr> <tr> <td colspan=2 style='text-align: right;'>Subtotal:</td> <td style='text-align: right;'>£ ".number_format($price_total,2)."</td> </tr>"; if($price_total >= 10){ $postage = 0; }else{ $postage = 1; } $price_total = $price_total + $postage; $content = $content." <tr> <td colspan=2 style='text-align: right;'>Postage:</td> <td style='text-align: right;'>£ ".number_format($postage,2)."</td> </tr> <tr> <td colspan=2 style='text-align: right;'>Total:</td> <td style='text-align: right;'>£ ".number_format($price_total,2)."</td> </tr> </table> </center> </div> </body> </html>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: ' . $account['email']."\r\n" . 'Reply-To: '. $account['email']."\r\n"; mail($email,$email_title,$content,$headers); session_destroy(); ?> <h1>Thank you for your order!</h1> <p>We have received your order and are currently processing it. We will post your order out to you in the next few days. Thank you for visiting Shitstix.</p> <? include 'footer.php'; ?> Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 22, 2007 Share Posted July 22, 2007 You're missing the closing double quote in this part: <p>Thank You</p> Shitstix Team" ; Try: <?php include 'header.php'; $account = mysql_query("SELECT * FROM customers WHERE username='$_SESSION[username]' AND password='$_SESSION[password]'") or die(mysql_error()); $account = mysql_fetch_array($account); $date = date("Y-m-d"); $orders = mysql_query("SELECt * FROM orders WHERE order_date='$date' ORDER BY complete_id DESC LIMIT 1") or die(mysql_error()); $lastorder = mysql_fetch_array($orders); $lastorder = $lastorder[complete_id]; $next_order = $lastorder + 1; mysql_query("UPDATE orders SET cust_id='$account[id]', order_date='$date', complete_id='$next_order', status='payment complete' WHERE id='$_SESSION[order_id]'") or die(mysql_error()); $order_name = date("d").'-'.date("m").'-'.$next_order; $email_title = "Shitstix Order Confirmation"; $email_content = " Dear ".$account['firstname'].", <p>Thank you for your recent order at Shitstix.co.uk. We are emailing you to let you know that we are currently processing your order and will post your order out to you within the next few days. If you have any questions regarding your order, please feel free to email us at clivestix@btinternet.com.</p> <p>Thank You</p> Shitstix Team"//you missed off the " here ; $email = "clivestix@btinternet.com"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: ' . $email."\r\n" . 'Reply-To: '. $email."\r\n"; mail($account['email'],$email_title,$email_content,$headers); /* $prod_array = Array(); $order_products = mysql_query("SELECT * FROM order_log WHERE order_id='$_SESSION[order_id]' ORDER BY product_id") or die(mysql_error()); $numrows = mysql_num_rows($order_products); while($order_product = mysql_fetch_array($order_products)){ if(in_array($order_product[product_id],$prod_array) == FALSE){ $prod_array[] = $order_product[product_id]; $product_count = mysql_query("SELECT * FROM order_log WHERE order_id='$_SESSION[order_id]' AND product_id='$order_product[product_id]'") or die(mysql_error()); $product_count = mysql_num_rows($product_count); $product_det = mysql_query("SELECT * FROM products WHERE id='$order_product[product_id]'") or die(mysql_error()); $product_det = mysql_fetch_array($product_det); $orderlog = $orderlog . $product_count.' - ' .$product_det['name'].' '; } } $email_title = "Shitstix Order"; $email_content = " The following order needs to be processed and posted to: ".$order_name." ".$account['name']." ".$account['surname']." ".$account['addline1']." ".$account['addline2']." ".$account['addline3']." ".$account['addline4']." Order Details: ".$orderlog." "; */ $content = " <div style='font-family: arial; font-size: 14px;'> <div style='width: 100%; border-bottom: 2px solid #000; padding: 10px; text-align: center; font-family: Comic Sans MS;'><h1>Shitstix.co.uk</h1></div> <h2 style='font-size: 16px;'>Shitstix Order: ".$order_name."</h2> <div style='border: 1px solid #000; padding: 5px;'> Customer: ".$account['firstname']." ".$account['surname']." ".$account['addline1']." ".$account['addline2']." ".$account['addline3']." ".$account['postcode']." </div> Dear ".$account[firstname].", <p>Thank you for ordering from Shitstix.co.uk. We have enclosed your order along with this invoice.</p> Best Regards, Shitstix Team <center> <table border=0 cellpadding=0 cellspacing=0 style='width: 100%; font-family: arial; font-size: 11px;'> <tr> <td colspan=2 style='border-bottom: 1px solid #C2C2C1; text-align: left;'>Item</td> <td style='border-bottom: 1px solid #C2C2C1; text-align: left;'>Quantity</td> </tr>"; $total = 0; $price_total = 0; $prod_array = Array(); $groups = mysql_query("SELECT * FROM groups ORDER BY id") or die(mysql_query()); while($group = mysql_fetch_array($groups)){ $content = $content." <tr> <td colspan=3 style='font-weight: bold; text-align: left;'><h2 style='color: #000000;font-size: 14px;'>".$group['name']."</h2></td> </tr>"; $order_products = mysql_query("SELECT * FROM order_log WHERE order_id='$_SESSION[order_id]' AND group_id='$group[id]' ORDER BY product_id") or die(mysql_error()); $numrows = mysql_num_rows($order_products); if($numrows > 0){ while($order_product = mysql_fetch_array($order_products)){ if(in_array($order_product[product_id],$prod_array) == FALSE){ $prod_array[] = $order_product[product_id]; $product_count = mysql_query("SELECT * FROM order_log WHERE order_id='$_SESSION[order_id]' AND product_id='$order_product[product_id]'") or die(mysql_error()); $product_count = mysql_num_rows($product_count); $product_det = mysql_query("SELECT * FROM products WHERE id='$order_product[product_id]'") or die(mysql_error()); $product_det = mysql_fetch_array($product_det); $content = $content ." <tr> <td width=1% style='border-top: 1px solid #e7e7e7; border-bottom: #e7e7e7;'></td> <td style='border-top: 1px solid #e7e7e7; border-bottom: #e7e7e7; text-align: left;'>".$product_det['name']." </td> <td style='border-top: 1px solid #e7e7e7; border-bottom: #e7e7e7; text-align: right;'>".$product_count."</td> </tr>"; $total = $total + $product_count; $price_total = $price_total + ($product_det[price] * $product_count); }else{ $content = $content." <tr> <td colspan=3 style='text-align: center;'>".$group['name']."s</td> </tr>"; } } } } $content = $content . " <tr> <td colspan=2 style='border-top: 1px solid #C2C2C1; text-align: right;' width=90%>Total Items:</td> <td style='border-top: 1px solid #C2C2C1; text-align: right;'> ".$total."</td> </tr> <tr> <td colspan=2 style='text-align: right;'>Subtotal:</td> <td style='text-align: right;'>£ ".number_format($price_total,2)."</td> </tr>"; if($price_total >= 10){ $postage = 0; }else{ $postage = 1; } $price_total = $price_total + $postage; $content = $content." <tr> <td colspan=2 style='text-align: right;'>Postage:</td> <td style='text-align: right;'>£ ".number_format($postage,2)."</td> </tr> <tr> <td colspan=2 style='text-align: right;'>Total:</td> <td style='text-align: right;'>£ ".number_format($price_total,2)."</td> </tr> </table> </center> </div> </body> </html>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: ' . $account['email']."\r\n" . 'Reply-To: '. $account['email']."\r\n"; mail($email,$email_title,$content,$headers); session_destroy(); ?> <h1>Thank you for your order!</h1> <p>We have received your order and are currently processing it. We will post your order out to you in the next few days. Thank you for visiting Shitstix.</p> <? include 'footer.php'; ?> For future reference, when you post, can you try and use tags(without the spaces). Makes it much easier to read Quote Link to comment Share on other sites More sharing options...
mickstacey Posted July 22, 2007 Author Share Posted July 22, 2007 thanks so much. you are a legend ;0) any ideas why when an order is placed I don't get an email with the order details incuded? I am not getting any errors now just no 'confirmation of order' emails. thanks again mick Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 22, 2007 Share Posted July 22, 2007 Try checking for success with the mail function to start with: <?php if(mail($account['email'],$email_title,$email_content,$headers)){ echo 'mail sent successfuly'; }else{ echo 'email could not be sent'; ?> You'll also need to apply that to the other mail you send - not quite sure why you are sending two emails though. If its being sent, it could be to do with where you are sending it to - you might need to turn off some spam filters. Also, if you're using a free host, then that could be the problem. A lot of them disable the mail function to protect them from people signing up to spam others. Quote Link to comment Share on other sites More sharing options...
mickstacey Posted July 22, 2007 Author Share Posted July 22, 2007 thanks Ben, Does it matter where i put the code because I am now getting the error Parse error: syntax error, unexpected '<' in /home/shitsti/public_html/payment_complete.php on line 25 Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 22, 2007 Share Posted July 22, 2007 I expected what you probably need to do is remove the opening and closing php tags from the code i posted. The reason why i put them in so that the code gets syntax highligting, making it easier to read. Quote Link to comment Share on other sites More sharing options...
mickstacey Posted July 22, 2007 Author Share Posted July 22, 2007 oh I see. stupid or what !! now getting error <?Parse error: syntax error, unexpected $end in /home/shitsti/public_html/payment_complete.php on line 179?> lines 177,178 and 179 are <? include 'footer.php'; ?> Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 22, 2007 Share Posted July 22, 2007 Whoops. I made another typo in my code. That keeps happening tonight. I forgot to close the else statment. Try using: <?php if(mail($account['email'],$email_title,$email_content,$headers)){ echo 'mail sent successfuly'; }else{ echo 'email could not be sent'; }//this is the bit i forgot ?> Dont forget to remove the opening and closing tags again Quote Link to comment Share on other sites More sharing options...
mickstacey Posted July 22, 2007 Author Share Posted July 22, 2007 Thats fixed it but the web page is displaying email could not be sent. I don't know if thats because I have done it wrong or not. if(mail($account['email']//should I put the actual email address in here or just copy the exactly as is?,$email_title,$email_content,$headers)){ echo 'mail sent successfuly'; }else{ echo 'email could not be sent'; } you mentioned I need to put it near the other email address also. I'm confused as to which line to put both sets of code on. does it make any difference ort can I put them both anywhere? Quote Link to comment Share on other sites More sharing options...
mickstacey Posted July 22, 2007 Author Share Posted July 22, 2007 <?phpif(mail($account['email']//should I put the actual email address in here or just copy the exactly as is?,$email_title,$email_content,$headers)){ echo 'mail sent successfuly'; }else{ echo 'email could not be sent'; >? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 22, 2007 Share Posted July 22, 2007 Ok, firstly, you cant put comments in the middle of the line like you've done in your post - they comment the rest of the line out. Im assuming thats not in the code you ran, otherwise you would have got an error. In response to the comment, im only going with the code you had - you were previously sedning the email to whatever was in $account['email'] so i assume that's still supposed to be the case. What i said about the other mail is that you use the mail() function twice. I mean that you should wrap that function in the same if, else block as this one. Overall though, it seems like the email is not being sent. As i mentioned earlier - this could be to do with your host - are you using a free host? Quote Link to comment Share on other sites More sharing options...
mickstacey Posted July 22, 2007 Author Share Posted July 22, 2007 Sorry to be a pain in the butt here I do appreciate your help and understand it must be frustrating dealing with an idiot like me but I'm learning (slowly) No it's not free hosting. I have checked my emails now and I am getting emails which is a step in the right direction since making the amendments but the emails are saying 'mail failure no recipient address' with the following message; A message that you sent contained no recipient addresses, and therefore no delivery could be attempted. ------ This is a copy of your message, including all the headers. ------ To: Subject: Shitstix Order Confirmation Message-Id: <E1ICiYw-0003fz-3F@sentra.websitewelcome.com> From: shitsti@sentra.websitewelcome.com Date: Sun, 22 Jul 2007 16:01:58 -0500 Dear ,<br><br> <p>Thank you for your recent order at Shitstix.co.uk. We are emailing you to let you know that we are currently processing your order and will post your order out to you within the next few days. If you have any questions regarding your order, please feel free to email us at clivestix@btinternet.com.</p> <p>Thank You</p> Shitstix Team Quote Link to comment Share on other sites More sharing options...
mickstacey Posted July 22, 2007 Author Share Posted July 22, 2007 actually I now why this is happening so forget my last post. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 22, 2007 Share Posted July 22, 2007 So, its all working now? Great. Dont forget, we all start somewhere! Quote Link to comment Share on other sites More sharing options...
mickstacey Posted July 22, 2007 Author Share Posted July 22, 2007 Ben. thanks for all your help. Apologies for the hassle. Mick 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.