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

  • Home
  • SEARCH
  • 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 7888115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:45:11+00:00 2026-06-03T05:45:11+00:00

$status returns 0, but loop acts like its 1. Funny thing here is my

  • 0

$status returns 0, but loop acts like its “1”. Funny thing here is my error message is “MySQL DB is in use (status 0)”.

In other words: my if statement fails even if its true.

Where is mistake?

include 'status_check.php'; //it takes $check from MySQL DB
if($status = "0") { //if status is 0 go on
    include 'status_1.php'; //set status to 1
            ...
    include 'status_0.php'; //after finished operation set status back to 0
} else { //if status is 1 say that its 1
    echo "MySQL DB is in use (status ". $status .")";
    die;
}
  • 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-03T05:45:12+00:00Added an answer on June 3, 2026 at 5:45 am

    You’re assigning, not comparing.

    if($status = "0") {
    

    Make that == for a comparison.

    It’s thus false because the string “0” is treated as a “falsy” value in PHP.
    Docs: http://php.net/boolean#language.types.boolean.casting

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When doing query optimization, the SHOW STATUS query returns values that are easy to
Suppose we have the xhr 'POST' request that returns 'redirect' status code. In that
In my wp7 application I do a web request that returns a status code
I'm trying to decode a selenium server's response. The server returns: {sessionId:null,status:0,value:{os:{arch:amd64,name: Windows Server
Ok this is the scenario... I have a table in Oracle that acts like
I want to use clone to log the current status of my program. It
So, I have this jQuery .each loop, and for the most part its working
I didn't find any question like this here. Yesterday I finally got Gingerbread 2.3.4
I am trying to display from a MySQL Database using PHP and Ajax but
how can i stop my loop if prod_Available < 0 (negative value) and returns

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.