iamz3r0 Posted August 7, 2009 Share Posted August 7, 2009 I recieve this: Fatal error: Cannot break/continue 1 level in /home/westwind/public_html/phpbb3/includes/functions_posting.php on line 1789 The code around line 1789 is: // Start Ultimate Points $sql = 'SELECT points_received, poster_id FROM ' . POSTS_TABLE . ' WHERE post_id = ' . $data['post_id']; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); if ( $config['points_enable'] && $user->data['user_id'] == $row['poster_id'] ) { $sql = "UPDATE " . USERS_TABLE . " SET user_points = user_points - " . $row['points_received'] . " WHERE user_id = '" . $row['poster_id'] . "'"; $db->sql_query($sql); $sql = "UPDATE " . POSTS_TABLE . " SET points_received = points_received - " . $row['points_received'] . " WHERE post_id = '" . $data['post_id'] . "'"; $db->sql_query($sql); $ultimate_points->new_post_ch($data['forum_id'], $data['post_id'], $ultimate_points->strip_text($data['message'])); } // End Ultimate Points $sql_data[postS_TABLE]['sql']['post_text'] = $data['message']; } break; } $post_approved = $sql_data[postS_TABLE]['sql']['post_approved']; $topic_row = array(); Link to comment https://forums.phpfreaks.com/topic/169257-solved-fatal-error-cannot-breakcontinue-1-level/ Share on other sites More sharing options...
wildteen88 Posted August 7, 2009 Share Posted August 7, 2009 Why is break there? break should only be used within a switch/case statement Link to comment https://forums.phpfreaks.com/topic/169257-solved-fatal-error-cannot-breakcontinue-1-level/#findComment-893140 Share on other sites More sharing options...
mikesta707 Posted August 7, 2009 Share Posted August 7, 2009 ahh I just had this error! but for a much different reason. You don't seem to have any statement that the break would be in. you have multiple closing brackets in the posted code, but only one opening bracket. post the code thats above what you posted Link to comment https://forums.phpfreaks.com/topic/169257-solved-fatal-error-cannot-breakcontinue-1-level/#findComment-893141 Share on other sites More sharing options...
iamz3r0 Posted August 7, 2009 Author Share Posted August 7, 2009 Okay, I removed the extra bracket and the break. The code looks like: // Start Ultimate Points $sql = 'SELECT points_received, poster_id FROM ' . POSTS_TABLE . ' WHERE post_id = ' . $data['post_id']; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); if ( $config['points_enable'] && $user->data['user_id'] == $row['poster_id'] ) { $sql = "UPDATE " . USERS_TABLE . " SET user_points = user_points - " . $row['points_received'] . " WHERE user_id = '" . $row['poster_id'] . "'"; $db->sql_query($sql); $sql = "UPDATE " . POSTS_TABLE . " SET points_received = points_received - " . $row['points_received'] . " WHERE post_id = '" . $data['post_id'] . "'"; $db->sql_query($sql); $ultimate_points->new_post_ch($data['forum_id'], $data['post_id'], $ultimate_points->strip_text($data['message'])); } // End Ultimate Points $sql_data[postS_TABLE]['sql']['post_text'] = $data['message']; } $post_approved = $sql_data[postS_TABLE]['sql']['post_approved']; $topic_row = array(); But now I get: Parse error: syntax error, unexpected $end in /home/westwind/public_html/phpbb3/includes/functions_posting.php on line 2661 Link to comment https://forums.phpfreaks.com/topic/169257-solved-fatal-error-cannot-breakcontinue-1-level/#findComment-893149 Share on other sites More sharing options...
wildteen88 Posted August 7, 2009 Share Posted August 7, 2009 Okay, I removed the extra bracket... No you should not remove the bracket. No one suggested that. Add the bracket back in and your code will work again. Link to comment https://forums.phpfreaks.com/topic/169257-solved-fatal-error-cannot-breakcontinue-1-level/#findComment-893156 Share on other sites More sharing options...
iamz3r0 Posted August 7, 2009 Author Share Posted August 7, 2009 Oops. I'm a lil new at it, so it still gets me confused. I added the bracket, and all is well. I just have to run through the forum to make sure its all working. Link to comment https://forums.phpfreaks.com/topic/169257-solved-fatal-error-cannot-breakcontinue-1-level/#findComment-893158 Share on other sites More sharing options...
mikesta707 Posted August 7, 2009 Share Posted August 7, 2009 So now i'm confused. did you get rid of the break and was the problem solved? Link to comment https://forums.phpfreaks.com/topic/169257-solved-fatal-error-cannot-breakcontinue-1-level/#findComment-893168 Share on other sites More sharing options...
iamz3r0 Posted August 7, 2009 Author Share Posted August 7, 2009 So now i'm confused. did you get rid of the break and was the problem solved? I deleted the break and the bracket, and it gave me an error. So I added the bracket back in there, and it works. Link to comment https://forums.phpfreaks.com/topic/169257-solved-fatal-error-cannot-breakcontinue-1-level/#findComment-893170 Share on other sites More sharing options...
sid0972 Posted February 16, 2013 Share Posted February 16, 2013 i get the same error, but the problem is that i dont have the bracket problem as iamz3r0 faced, i really have to use break. and if i cant use break, what can i use? Link to comment https://forums.phpfreaks.com/topic/169257-solved-fatal-error-cannot-breakcontinue-1-level/#findComment-1412828 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.