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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:19:32+00:00 2026-06-06T22:19:32+00:00

Im trying to update a table with the following code. If I change WHERE

  • 0

Im trying to update a table with the following code. If I change WHERE temp_booking_id = ':temp_booking_id'"); to use the actual, current session temp_id, the query will run, but adds the placeholders into the table (e.g.: check-out) as the value.

$data is holding the correct values, but is not replacing the placeholders.

Been staring at this for hours and can’t for the life of me work out what the problem is, and looked around but haven’t found a solution.

PDOStatement:errorInfo() is returning

PDOStatement::errorInfo(): Array ( [0] => 00000 )

and if I remove the inverted commas around the placeholders, it returns

PDOStatement::errorInfo(): Array ( [0] => HY093 )

Any ideas?

try {
  $data = array(
    'temp_booking_id' => $_SESSION['temp_id'],
    'check_in' => $in,
    'check_out' => $out, 
    'adults' => $a,
    'children1' => $c1,
    'children2' => $c2,
    'infants' => $i,
    'cots' => $c,
    'promo_code' => $pc
 );

 $STH = $DBH->prepare("UPDATE b_temp_booking 
   SET check_in = ':check_in',
   check_out = ':check_out',
   adults = ':adults',
   children1 = ':children1',
   children2 = ':children2',
   infants = ':infants',
   cots = ':cots',
   promo_code = ':promo_code' 
   WHERE temp_booking_id = ':temp_booking_id'");

 $STH->execute($data);

 echo "\nPDOStatement::errorInfo():\n";
 $arr = $STH->errorInfo();
 print_r($arr);

} catch(PDOException $e) {
  echo 'ERROR: ' . $e->getMessage();
}
  • 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-06T22:19:33+00:00Added an answer on June 6, 2026 at 10:19 pm

    Hmmm, it seems that your SQL statement doesn’t require the single quotes. For example, you can try running this block instead:

       $STH = $DBH->prepare("UPDATE b_temp_booking 
       SET check_in = :check_in,
       check_out = :check_out,
       adults = :adults,
       children1 = :children1,
       children2 = :children2,
       infants = :infants,
       cots = :cots,
       promo_code = :promo_code 
       WHERE temp_booking_id = :temp_booking_id");
    

    Check out the PHP manual on PDO prepared statements: http://www.php.net/manual/en/pdo.prepared-statements.php
    It looks like it here that the quotes are not necessary around the named placeholders.

    Also, try following their example where they use the bindParam() method:

    $STH->bindParam(':temp_booking_id', $temp_booking_id);
    
    $temp_booking_id = $_SESSION['temp_id']; // Not sure how binding the environment variable will work, so decoupling it.
    
    $STH->bindParam(':check_in', $in);
    $STH->bindParam(':check_out', $out); 
    $STH->bindParam(':adults', $a);
    $STH->bindParam(':children1', $c1);
    $STH->bindParam(':children2', $c2);
    $STH->bindParam(':infants', $i);
    $STH->bindParam(':cots', $c);
    $STH->bindParam(':promo_code', $pc);
    

    When you are ready to execute, you can run the following line:

    $STH->execute();
    

    Check it out and see if binding the parameters is what you’re looking for.

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

Sidebar

Related Questions

I am trying to use following code, but I am unable to update my
I'm trying to a create an update statement along the following lines: TABLE car:
I am trying to run the following code to loop around a recordset and
I am trying to update table A with data from table B. I thought
I am trying to update a table and I am only given a varchar
I'm trying to update a table in my DynamoDB tables using the PHP SDK.
I'm trying to update a table from a form. I have 3 pages. The
I'm trying to update one table based on values in another table. What's wrong
I am trying to update a table according to this trigger: CREATE TRIGGER alert
I have been trying to update a table in MySQL 5.0 with Coldfusion MX

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.