Jump to content

Parse error: parse error, unexpected '}'


jwk811

Recommended Posts

heres a big piece of this code
[code]// orders have been processed
// give the shopper intructions depending on what their payment method is
$paypal_message = 'PayPal Shopper';
$cod_message = 'COD Shopper';
$error_message = 'An Error Has Occured. Please Contact Live Chat For Assistance.';
// check payment method and assign different messages for each
if ($_SESSION['paypal']);
$content = $paypal_message;

} else if ($_SESSION['cod']);
$content = $cod_message;
} else {
echo '$error_message';

}
} else {
// something went wrong
$content = $error_message;[/code]
can you figure it out yet?
You shouldnt put a semicolon after an if.
It should be this way-
[code]<?php
// orders have been processed
// give the shopper intructions depending on what their payment method is
$paypal_message = 'PayPal Shopper';
$cod_message = 'COD Shopper';
$error_message = 'An Error Has Occured. Please Contact Live Chat For Assistance.';
// check payment method and assign different messages for each
if ($_SESSION['paypal'])
$content = $paypal_message;

} else if ($_SESSION['cod'])
$content = $cod_message;
} else {
echo '$error_message';
} else {
// something went wrong
$content = $error_message;

?>[/code]

Orio.
your problem lies with ur elseif statement... ur code should look like this:

[code=php:0]// orders have been processed
// give the shopper intructions depending on what their payment method is
$paypal_message = 'PayPal Shopper';
$cod_message = 'COD Shopper';
$error_message = 'An Error Has Occured. Please Contact Live Chat For Assistance.';
// check payment method and assign different messages for each
if ($_SESSION['paypal']) {
$content = $paypal_message;

} elseif ($_SESSION['cod']) {
$content = $cod_message;
} else {
echo '$error_message';

}
} else {
// something went wrong
$content = $error_message;
}
[/code]

edit:  crap sorry, you had missing braces all over the place.
still not working.. heres the entire chunck of this script
[code]// send notification email
if ($shopConfig['sendOrderEmail'] == 'y') {
$subject = "[New Order] " . $_SESSION['orderId'];
$email  = $shopConfig['email'];
$message = "You have a new order. Check the order detail here \n http://" . $_SERVER['HTTP_HOST'] . WEB_ROOT . 'admin/order/index.php?view=detail&oid=' . $_SESSION['orderId'] ;
mail($email, $subject, $message, "From: $email\r\nReturn-path: $email");
}

// orders have been processed
// give the shopper intructions depending on what their payment method is
$paypal_message = 'PayPal Shopper';
$cod_message = 'COD Shopper';
$error_message = 'An Error Has Occured. Please Contact Live Chat For Assistance.';
// check payment method and assign different messages for each
if ($_SESSION['paypal']) {
$content = $paypal_message;

} elseif ($_SESSION['cod']) {
$content = $cod_message;
} else {
echo '$error_message';
}

} else {
// something went wrong
$content = $error_message;
}[/code]with this im now getting Parse error: parse error, unexpected '}' on line 38 which is where the } else { is
... any ideas?
If you'll look at the if part you can see there's an extra brace. (I modified the spacing a bit so you can see it better):

[code]<?php
if ($shopConfig['sendOrderEmail'] == 'y')
{
//some code here
} //I think this brace isn't supposed to be here, and the one I marked as "meaing less" should be there

//more code here...

if ($_SESSION['paypal']) {$content = $paypal_message;}
elseif ($_SESSION['cod']) {$content = $cod_message;}
else {echo '$error_message';}

} //this brace is meaning less

else {$content = $error_message;}

?>[/code]

Look at the comments in the script, they're important.

Orio.

Archived

This topic is now archived and is closed to further replies.

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