bgc42169 Posted May 19, 2009 Share Posted May 19, 2009 This is the part of the programing: $o[] = $orders['orders_id']; for($i=0;$i<sizeof($o);$i++) { $price = 0; $cost = 0; $items_sold = 0; $prods_query = mysql_query("select op.products_id, op.products_price, op.final_price, op.products_quantity, p.products_cost, op.final_cost from orders_products op, products p where op.orders_id = '" . $o[$i] . "' and op.products_id = p.products_id"); while ($prods = mysql_fetch_array($prods_query)) { //Changes for Margins Reports 3.1b change product_price, Product_cost to final_price and final_cost // $p[] = array($prods['products_id'], $prods['products_price'], $prods['products_cost'], $prods['final_price'], $prods['final_cost'], $prods['products_quantity']); // $p[] = array($prods['products_id'], $prods['products_price'], $prods['products_cost'], $prods['products_quantity']); if ($prods['final_cost'] == 0.000)( $cost = $cost + ($prods['products_cost'] * $prods['products_quantity']); //THIS IS LINE 87 in the code. $price = $price + ($prods['products_price'] * $prods['products_quantity']); $total_price = $total_price + ($prods['products_price'] * $prods['products_quantity']); $total_cost = $total_cost + ($prods['products_cost'] * $prods['products_quantity']); ) else ( $cost = $cost + ($prods['final_cost'] * $prods['products_quantity']); $price = $price + ($prods['final_price'] * $prods['products_quantity']); $total_price = $total_price + ($prods['final_price'] * $prods['products_quantity']); $total_cost = $total_cost + ($prods['final_cost'] * $prods['products_quantity']); ) $items_sold = $items_sold + $prods['products_quantity']; $total_items_sold = $total_items_sold + $prods['products_quantity']; } } I get a parse error at line 87 Unexpected ";" When i remove the if Else statement no problems. But i need this if statement. Can anyone help me ??? BRuce Quote Link to comment Share on other sites More sharing options...
♥geoffreywalton Posted May 19, 2009 Share Posted May 19, 2009 Most coders use curly brackets if ($prods['final_cost'] == 0.000){ $cost = $cost + ($prods['products_cost'] * $prods['products_quantity']); //THIS IS LINE 87 in the code. $price = $price + ($prods['products_price'] * $prods['products_quantity']); $total_price = $total_price + ($prods['products_price'] * $prods['products_quantity']); $total_cost = $total_cost + ($prods['products_cost'] * $prods['products_quantity']); } else { $cost = $cost + ($prods['final_cost'] * $prods['products_quantity']); $price = $price + ($prods['final_price'] * $prods['products_quantity']); $total_price = $total_price + ($prods['final_price'] * $prods['products_quantity']); $total_cost = $total_cost + ($prods['final_cost'] * $prods['products_quantity']); } Quote Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile Virus Threat Scanner My Contributions Basic install answers. Click here for Contributions / Add Ons. UK your site. Site Move. Basic design info. For links mentioned in old answers that are no longer here follow this link Useful Threads. If this post was useful, click the Like This button over there ======>>>>>. Link to comment Share on other sites More sharing options...
bgc42169 Posted May 20, 2009 Author Share Posted May 20, 2009 Most coders use curly brackets if ($prods['final_cost'] == 0.000){ $cost = $cost + ($prods['products_cost'] * $prods['products_quantity']); //THIS IS LINE 87 in the code. $price = $price + ($prods['products_price'] * $prods['products_quantity']); $total_price = $total_price + ($prods['products_price'] * $prods['products_quantity']); $total_cost = $total_cost + ($prods['products_cost'] * $prods['products_quantity']); } else { $cost = $cost + ($prods['final_cost'] * $prods['products_quantity']); $price = $price + ($prods['final_price'] * $prods['products_quantity']); $total_price = $total_price + ($prods['final_price'] * $prods['products_quantity']); $total_cost = $total_cost + ($prods['final_cost'] * $prods['products_quantity']); } Damn, My eyes are really started to not work. Thanks. Bruce 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.
Note: Your post will require moderator approval before it will be visible.