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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:43:53+00:00 2026-05-14T00:43:53+00:00

this is the code I’m using: self::$DB->prepare($query, $types); when the $query and types are:

  • 0

this is the code I’m using:

self::$DB->prepare($query, $types);

when the $query and types are:

//$query
UPDATE Permisos
    SET                 
        empleado_id = ?,
        agregar_mensaje = ?,
        borrar_mensaje = ?,
        agregar_noticia = ?,
        borrar_noticia = ?,
        agregar_documento = ?,
        borrar_documento = ?,
        agregar_usuario = ?,
        borrar_usuario = ?,
        agregar_empresa = ?,
        borrar_empresa = ?,
        agregar_tarea = ?
    WHERE
        id = ?
//$types
Array(
    [0] => integer
    [1] => boolean
    [2] => boolean
    [3] => boolean
    [4] => boolean
    [5] => boolean
    [6] => boolean
    [7] => boolean
    [8] => boolean
    [9] => boolean
    [10] => boolean
    [11] => boolean
    [12] => integer
)

Everything works great, but when they are:

//$query
UPDATE Permisos SET                         
         empleado_id = ?,
         agregar_mensaje = ?,
         borrar_mensaje = ?,
         agregar_noticia = ?,
         borrar_noticia = ?,
         agregar_documento = ?,
         borrar_documento = ?,
         agregar_usuario = ?,
         borrar_usuario = ?,
         agregar_empresa = ?,
         borrar_empresa = ?,
         agregar_tarea = ?,
         borrar_tarea = ?
    WHERE
id = ?
//$types
Array(
        [0] => integer
        [1] => boolean
        [2] => boolean
        [3] => boolean
        [4] => boolean
        [5] => boolean
        [6] => boolean
        [7] => boolean
        [8] => boolean
        [9] => boolean
        [10] => boolean
        [11] => boolean
        [12] => boolean
        [13] => integer
    )

It fails with the following message:

<b>Warning</b>:  PDO::prepare() [<a href='pdo.prepare'>pdo.prepare</a>]: SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); the classname must be a string specifying an existing class in <b>C:\wamp\www\intratin\JP\includes\empleado\mapper\Permiso.php</b> on line <b>137</b><br />

Doesn’t matter which field I add or remove, it fails every time with more than 13 placeholders.

  • 1 1 Answer
  • 3 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-14T00:43:53+00:00Added an answer on May 14, 2026 at 12:43 am

    If you self::$DB->prepare method is actually calling PDO::prepare, make sure that you don’t pass that $types argument as a second parameter to PDO::prepare

    Judging from the documentation, the second parameter that PDO::prepare expects is an array of options — not an array describing the type of data for each placeholder.

    And you try to execute this portion of code :

    var_dump(PDO::ATTR_STATEMENT_CLASS);
    

    You’ll get this output :

    int 13
    

    Which kind of explains the error :

    • You are trying to pass to PDO::prepare and array as second parameter
    • PDO::prepare expects that array to contain a list of options
    • You have an element with key 13 in your array
    • 13 is PDO::ATTR_STATEMENT_CLASS
    • PDO::preapre expects something specific for the PDO::ATTR_STATEMENT_CLASS option
      • like something corresponding to array(classname, array(ctor_args));, judging from your error message
    • You’re passing integer instead of that
    • So you get an error.

    Not sure how you can specify the types of each bound parameters with the class you are using — but it seems it’s not as a second parameter to `prepare` 😉

    And, if your self::$DB is indeed an instance of PDO, I don’t find a method that would allow you to specify the types of all parameters at once — it seems you have to specify the type for each parameter, each time you call either bindParam or bindValue.

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

Sidebar

Related Questions

This code comes from: http://code.activestate.com/recipes/577090-file-encryption-using-stream-cipher/ import sys import random if len(sys.argv) != 4: print
This code works properly in my localhost. I am using xampp 1.7.3. but when
This code: public class PhotoDescriptor { public DateTime DateCreatedUtc { get; set; } }
This code is C/C++ and runs without warnings or debug messages. I'm using Code::blocks
This code below allows me to find the word error in all my files
This code is the core of a much larger script that works great in
This code disabled mouse scroll functionality, when i click on the document. $(document).on(click, function
This code only renders a dodecahedron and completely ignores the glBegin(GL_TRIANGLES) block: glutSolidDodecahedron(); glBegin(GL_TRIANGLES);
This code gives me this error:Cannot implicitly convert type ArrayList[] to ArrayList[][] at this
This code fails on some machines: // Parse error: syntax error, unexpected '[' ...

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.