jwk811 Posted November 3, 2006 Share Posted November 3, 2006 I keep playing around with it but it keeps saying that and when i delete the } the error says i need oneughhh heres the line thats effected.. any help will be great! } else if ($_SESSION['cod']); Link to comment https://forums.phpfreaks.com/topic/26090-parse-error-parse-error-unexpected/ Share on other sites More sharing options...
Orio Posted November 3, 2006 Share Posted November 3, 2006 Can you post the whole code please?Orio. Link to comment https://forums.phpfreaks.com/topic/26090-parse-error-parse-error-unexpected/#findComment-119270 Share on other sites More sharing options...
Mutley Posted November 3, 2006 Share Posted November 3, 2006 I can't tell because you haven't posted the whole of the code, it could be a problem furter up, however, try...} else {if($_SESSION['cod']); Link to comment https://forums.phpfreaks.com/topic/26090-parse-error-parse-error-unexpected/#findComment-119271 Share on other sites More sharing options...
almightyegg Posted November 3, 2006 Share Posted November 3, 2006 }elseif($_SESSION['cod']){content here} Link to comment https://forums.phpfreaks.com/topic/26090-parse-error-parse-error-unexpected/#findComment-119276 Share on other sites More sharing options...
jwk811 Posted November 3, 2006 Author Share Posted November 3, 2006 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? Link to comment https://forums.phpfreaks.com/topic/26090-parse-error-parse-error-unexpected/#findComment-119278 Share on other sites More sharing options...
almightyegg Posted November 3, 2006 Share Posted November 3, 2006 [code=php:0]} else if ($_SESSION['cod']){ $content = $cod_message; } else { echo '$error_message'; }} else { // something went wrong $content = $error_message;[/code] Link to comment https://forums.phpfreaks.com/topic/26090-parse-error-parse-error-unexpected/#findComment-119279 Share on other sites More sharing options...
Orio Posted November 3, 2006 Share Posted November 3, 2006 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. Link to comment https://forums.phpfreaks.com/topic/26090-parse-error-parse-error-unexpected/#findComment-119284 Share on other sites More sharing options...
thepip3r Posted November 3, 2006 Share Posted November 3, 2006 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. Link to comment https://forums.phpfreaks.com/topic/26090-parse-error-parse-error-unexpected/#findComment-119293 Share on other sites More sharing options...
jwk811 Posted November 3, 2006 Author Share Posted November 3, 2006 still not working.. heres the entire chunck of this script[code]// send notification emailif ($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? Link to comment https://forums.phpfreaks.com/topic/26090-parse-error-parse-error-unexpected/#findComment-119312 Share on other sites More sharing options...
Orio Posted November 3, 2006 Share Posted November 3, 2006 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]<?phpif ($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 lesselse {$content = $error_message;}?>[/code]Look at the comments in the script, they're important.Orio. Link to comment https://forums.phpfreaks.com/topic/26090-parse-error-parse-error-unexpected/#findComment-119323 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.