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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:52:33+00:00 2026-06-11T19:52:33+00:00

I am having a little trouble saving bit-values into my PostgreSQL-DB using PDO. Whenever

  • 0

I am having a little trouble saving bit-values into my PostgreSQL-DB using PDO. Whenever the bit(bool) is false i get this error

Warning: PDOStatement::execute(): SQLSTATE[22026]: String data, length mismatch: 7 
ERROR: bit string length 0 does not match type bit(1) in /var/www/html/application/models/Database.php on line 75

The code is a little complicated to show, but here is what goes into the DB-class.

UPDATE users SET name=:name,email=:email,address=:address,zip=:zip,joindate=:joindate,phone=:phone,password=:password,activationcode=:activationcode,birthdate=:birthdate,lastdigits=:lastdigits,driverlicense=:driverlicense,e_presentation=:e_presentation,e_showphone=:e_showphone,e_showaddress=:e_showaddress,e_radius=:e_radius,e_showinsearch=:e_showinsearch,w_presentation=:w_presentation,w_showphone=:w_showphone,w_showaddress=:w_showaddress,w_radius=:w_radius,w_showinsearch=:w_showinsearch WHERE id=:id

And the data that is bound to the parameters

Array ( [:name] => My Name [:email] => myemail@gmail.com [:address] => My Address [:zip] => 79133 [:joindate] => 2012-09-18 12:39:56.769584 [:phone] => 073 917 13 97 [:password] => c6d18ac44b378ff3cecf09d9ebec31ad301c4394d7e1sdfjksc81cd3fbf47777f8df0ac9f33d14da18d71b76fc9c3e1210cb2efcabf6ed66f779d [:activationcode] => [:birthdate] => 1993-08-05 [:lastdigits] => 5079 [:driverlicense] => 0 [:e_presentation] => Test [:e_showphone] => 1 [:e_showaddress] => 1 [:e_radius] => 10 [:e_showinsearch] => 1 [:w_presentation] => Test [:w_showphone] => 1 [:w_showaddress] => 1 [:w_radius] => 10 [:w_showinsearch] => 1 [:id] => 28 ) 1

A quick Google-search shows me that others had the same problem, but no solution to it.

  • 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-11T19:52:35+00:00Added an answer on June 11, 2026 at 7:52 pm

    If we consider that a bit is a number that is either 1 or 0, then false in php is not a number.
    <? echo false; ?> prints an empty string, not the number 0.
    In a lot of other situations in php, 0 and false will be equivalent, but they’re still not the same thing, and from the point of view of PostgreSQL, an empty string as the value of a bit is not acceptable.

    The php code should convert false to 0 when passing the bit value to execute() or similar.
    Using

    $sth->bindParam(':param', $value, PDO::PARAM_INT);
    

    would also work when $value is false, since that would force a conversion to 0.

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

Sidebar

Related Questions

I'm having a little bit of trouble saving data to a database. Basically, I
Having a little trouble on this one. I need a way using Jquery/JS to
I'm having little trouble creating a script working with URLs. I'm using urllib.urlopen() to
I'm having a little trouble using AmazonCloudWatch to fetch CPU Utilization. When I try
I am having a little trouble trying to accomplish this. Here is the gist
Question: I'm having a little trouble with jQuery: Consider this HTML, where I want
Having a little trouble processing my NSStrings into a valid JSON string. NSString *version
I’m having a little trouble figuring this one out. I’m fairly new to C#,
I am having a little trouble understanding ServiceKnownType in WCF. Taken from this blog
I'm having a little trouble getting values out of an XML document. The document

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.