Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9102037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:16:56+00:00 2026-06-17T01:16:56+00:00

Ok this may be an elementary question, but I want an informed answer and

  • 0

Ok this may be an elementary question, but I want an informed answer and I can’t seem to get the keywords right to get an answer through google. If this is a duplicate please close it and point me in the right direction.

So here’s the question. In the code below, when the break that’s pointed to is executed, where does it break out too?

case 'changeEmployeeInfo':
    $con = db_connect(DBNAME, DBUSERNAME, DBPASSWORD , DBHOST);
    $query = 'UPDATE USERS SET firstname = ?, lastname = ?, email = ? where idusers = ?';
    $updateValues = array($firstName,$lastName,$email,$employeeID);
    $newID = db_change($query,$updateValues,$con);
    if($_SESSION['role']==1||$_SESSION['role']==3||$_SESSION['role']==4){
        if($_POST['status']== true){
            $status = 1;
        }elseif($_POST['status']==false){
            $status = 0;
        }
        else{
            break;//<--THIS IS THE BREAK I'M TALKING ABOUT
        }
        $query = 'UPDATE USERS SET status = ? where idusers = ?';
        $updateValues = array($status, $employeeID);
        $newID = db_change($query,$updateValues,$con);
    }
    db_disconnect($con);
    break;

My instinct tells me that the db_disconnect function will still be executed but the UPDATE USERS query and it’s associated lines will not be. Am I correct in thinking this? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:16:57+00:00Added an answer on June 17, 2026 at 1:16 am

    break in PHP breaks exactly one level, in your case the case. To break more levels, use break n:

    From the documentation:

    $i = 0;
    while (++$i) {
        switch ($i) {
        case 5:
            echo "At 5<br />\n";
            break 1;  /* Exit only the switch. */
        case 10:
            echo "At 10; quitting<br />\n";
            break 2;  /* Exit the switch and the while. */
        default:
            break;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may be a simple question but I can;t find the answer anywhere. Here
Ok, so this may seem an elementary question. Maybe it is. But for the
This may be a very elementary question for Java, but I just can't recall
This may be a stupid question, but I can't find an answer... I'm sending
This may sound like a completely stupid question, but how can I get the
this may sound pretty straight forward, but still I want to post this question
This may seem a bit crazy, but if you can tell me a better
This may be vague but hopefully someone can help me refine the question, but
This may seem like a stupid question but I just started learning javascript about
This may seem a bit silly, but I can't realize how I have to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.