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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:30:43+00:00 2026-06-06T10:30:43+00:00

I am querying my mysql-db using PDO, with a plain SELECT * FROM Invoices

  • 0

I am querying my mysql-db using PDO, with a plain “SELECT * FROM Invoices” query. Now all columns of type “bit” gets a blank value if i do print_r on the result from the query

Array
(
    [0] => stdClass Object
        (
            [ID] => 1
            [Client] => 1
            [Title] => Mars 2012
            [Issued] => 2012-04-02
            [Expiration] => 2012-04-22
            [OurReference] => 1
            [TheirReference] => 
            [Payed] => 
            [Sent] => 
        )

    [1] => stdClass Object
        (
            [ID] => 2
            [Client] => 4
            [Title] => Apputveckling
            [Issued] => 2012-04-30
            [Expiration] => 2012-05-21
            [OurReference] => 1
            [TheirReference] => 
            [Payed] => 
            [Sent] => 
        )

    [2] => stdClass Object
        (
            [ID] => 3
            [Client] => 4
            [Title] => Administration
            [Issued] => 2012-05-28
            [Expiration] => 2012-06-18
            [OurReference] => 1
            [TheirReference] => 
            [Payed] => 
            [Sent] => 
        )

)

How can that be?
This is the getData-method im using

public function getData($sql, $data = null)
{
    $statement = $this->query($sql, $data);
    try
    {
        $result = $statement->fetchAll();
    }
    catch(Exception $e)
    {
        echo "Error: " . $e->getMessage() . " ";
        return array();
    }

    if(count($result) > 1)
    {
        return $result;
    }
    else if(count($result) == 1)
    {
        return $result[0];
    }
    else
    {
        return array();
    }
}

EDIT: Forgot to mention, the rows do have values in the fields in the db

  • 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-06T10:30:44+00:00Added an answer on June 6, 2026 at 10:30 am

    The bit fields are mapped to booleans. A boolean false will be printed by print_r in exactly the way you see in your question. Here is a test script showing that:

    $a = array(new stdClass());
    $a[0]->Payed = false;
    print_r($a);
    

    Use var_dump instead and you should be able to see both the datatype of each property as well as the boolean content.

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

Sidebar

Related Questions

I'm querying a MySQL linked server from SQL Server. I can query the linked
i'm querying a database like this: SELECT * from Log WHERE cookieId IN (select
This is a follow up from my question: MySQL: Querying a table and possibly
I know I can change the way MySQL executes a query by using the
I am querying a mySQL database to retrieve the data from 1 particular row.
Well now at my company we are switching from MySQL 5 to PostgreSQL 8.4
I got a problem in querying an information in mySQL, here's the code: SELECT
I have a field in MySQL of type text, using the following collation: utf8_general_ci
I am using an ADO .Net Entity Model for querying a MySQL database. I
I am using PHP to query the MySQL database on my website. Please answer

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.