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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:37:04+00:00 2026-06-12T07:37:04+00:00

I have a PDO statement as follows( AFAIK , PDO doesn’t need data to

  • 0

I have a PDO statement as follows(AFAIK, PDO doesn’t need data to be escaped for preparation):

$insert = "INSERT INTO `errors`(`code`,`number`,`title`,`message`) VALUES( :code, :num, :title, :err )";
$arr = Array(
    Array( ':code', $_POST['code'], 'PDO::PARAM_STR' ),
    Array( ':num', $_POST['number'], 'PDO::PARAM_INT' ),
    Array( ':title', $_POST['title'], 'PDO::PARAM_STR' ),
    Array( ':err', htmlentities( str_replace("\n", "<br />", $_POST['error']), ENT_HTML5, 'UTF-8' ), 'PDO::PARAM_STR' )
);
$stmt = $conn->prepare($insert);
foreach( $arr as $a ) {
    $stmt->bindValue( $a[0], $a[1], $a[2] );
}
$stmt->execute();
$stmt->debugDumpParams();

This piece of code does nothing at all. But it does generate a dump like this:

SQL: [91] INSERT INTO `errors`(`code`,`number`,`title`,`message`) VALUES( :code, :num, :title, :err )
Params:  0
  • 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-12T07:37:05+00:00Added an answer on June 12, 2026 at 7:37 am

    The type info of a bind parameter is a constant, and not a string:

    Array( ':code', $_POST['code'], PDO::PARAM_STR )
    //                             ^              ^ no quotes
    

    Update

    The array should look like this:

    $arr = Array(
        Array( ':code', $_POST['code'], PDO::PARAM_STR ),
        Array( ':num', $_POST['number'], PDO::PARAM_INT ),
        Array( ':title', $_POST['title'], PDO::PARAM_STR ),
        Array( ':err', htmlentities( str_replace("\n", "<br />", $_POST['error']), ENT_HTML5, 'UTF-8' ), PDO::PARAM_STR )
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code for inserting data into database using PDO. It inserts data
I have the following PHP PDO statement: $STH = $this->_db->prepare(INSERT INTO UserDetails (FirstName, LastName,
I currently have this type of PDO statement to INSERT variables into the array
I have my input placed into mySQL through a PDO prepared statement, and have
I have a statement being used with PDO which is as follows: $stmt =
I have trouble with date data type. I have a php mysql pdo statement:
I have a while loop after a PDO statement. My code is below. $query
i have a pdo block for inserting values into my table as follows try{
I need to do a PDO statement that cross-references 3 tables and it seems
I have the following PDO statement: $stmt = $db->prepare(SELECT MAX(RID) FROM TEMP_ROUTE); $stmt->execute(); $rid

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.