Jump to content

[SOLVED] Code error


mickstacey

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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';

?>

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :P

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

 

 

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.