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 8468537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:57:47+00:00 2026-06-10T15:57:47+00:00

I got this piece of function that updates an account with 1 or 0,

  • 0

I got this piece of function that updates an account with 1 or 0,
note that the account_status has a data type of boolean.

I understand that $this->db->query(); returns TRUE or FALSE in write queries,

but i am having trouble, because when i tried to put a non boolean value on account_status, still the response is success, but obviously it will not update because the data is not boolean.

public function approve_account($id='0'){
        if($id == '0' OR $id== ''){
            return FALSE;
        }else{
            try{
                $id = (int)htmlentities($id,ENT_COMPAT,'UTF-8');
                $sql= "UPDATE elibrary.elib_user_account e 
                       SET account_status = 'hg' 
                       WHERE t_user_id = ?
                       LIMIT 1;";

                if($this->db->query($sql,$id) === TRUE){
                    echo 'sucess';
                }else{
                    echo 'FAIL';
                }
            }catch(Exception $e){
                echo $e;
            }
        }
    }
  • 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-10T15:57:48+00:00Added an answer on June 10, 2026 at 3:57 pm

    MySQL does not have a native boolean type, booleans are represented as tinyint(1). Storing string values in a numeric column would coerce them to a numeric value — in your case, the string 'hg' is not a valid integer, and is coerced to the value 0, which is stored in the account_status column and further interpreted as false. If your string contains a valid number, e.g. '5', it would be stored as the integer value 5, which is considered true for boolean operations.

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

Sidebar

Related Questions

I've got this piece of code in my jquery validation script: resetForm: function() {
I've got this piece of code to toggle a side panel: $(.example_wrapper_panel_link).click(function() { $(.example_wrapper).addClass('example_wrapper_active');
I've got the following piece of Jquery: $(#collapse-menu > li > a).click(function() { $(this).toggleClass(expanded).toggleClass(collapsed).find(+
Hallo all. I got this piece of code: <div> <input id=id1 name=radioButton type=radio> <input
I've got this really simple piece of code that I thought was the correct
I have got a piece of code, that should countdown some number (in this
I've got a function that takes data and either returns the same data or
I've got this piece of code for a jQTouch/jQuery page that dynamically resizes inputs
I got this piece of script (runned locally): <script> last = 0; function uploadnew(){
I got this piece of Assembly code extracted from some piece of software, but

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.