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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:28:11+00:00 2026-05-27T02:28:11+00:00

I moved my website to new server and found strange PDO behaviour: $q =

  • 0

I moved my website to new server and found strange PDO behaviour:

$q = $db->prepare("INSERT INTO tabel SET info = :info, time = :date, active = :date");
$q->bindParam(':info', $info);
$q->bindParam(':date', $date);
$q->execute();

Only time column gets $date, and active gets nothing.
If I change them active = :date, time = :date then it became vice versa. Only first column receives variable. Others receive nothing.

What can be done, to make it send binded one :date to both columns? Without duplicating :date1 :date2.

  • 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-05-27T02:28:12+00:00Added an answer on May 27, 2026 at 2:28 am

    You’ll have to name and match all parameters to their values, so you’ll have to go with something like what you said: :date2 and make sure to bind them, so you’ll end up with three bindParam statements.

    See here: https://bugs.php.net/bug.php?id=33886

    :: it was a question of portability (just to share)

    [edit/additional] ::
    I’d like to suggest a better practice, though at the beginning it might seem like a lot of work: Why don’t you use stored procedures? Check this: http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html

    What this can help you do is to accept just the two values as parameters but use them in three column updates. Here’s a sample:

    CREATE DEFINER=`root`@`localhost` PROCEDURE `InsertIntoTabel`
        (IN paramINFO VARCHAR(50), IN paramDATE DATETIME)
    BEGIN
        INSERT INTO tabel 
        SET info = paramINFO
        , time = paramDATE
        , active = paramDATE;
    END
    

    And then change your code to this:

    $q = $db->prepare("CALL InsertIntoTabel (?,?)");
    $q->bindParam(1, $info);
    $q->bindParam(2, $date);
    $q->execute();
    

    It’s only a suggestion, though. 🙂

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

Sidebar

Related Questions

I've got a new website moved to my server. This website uses PHP and
I just moved my website to a new server (Shared to VPS) I expected
We have just moved a website to a new server, both servers are Windows
I have moved my website and MySQL database to a new, free server at
We've recently moved our company website to a new host. It is an ASP.NET
We're developing a new eCommerce website and are using NHibernate for the first time.
I have just done the website migration from the old server to the new
Im looking into developing a new version of a client/server application for a client.
I moved my website from the /v1/etc... directory to the /v2/etc... directory and would
I recently moved my website to a shared hosting solution at asmallorange.com , 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.