Chris Nizzardini, Salt Lake City Utah, Web Developer Specializing in LAMP+Ajax Since 2006

My Blog

Here is my awesome blog. You can find information on programming, linux, documentation, tips for code and database optimization, my thoughts and rants, and whatever else I feel like sharing. Feel free to contribute to the blog by posting comments and asking questions.
Programming

What is PDO Error HY093: Debug/Fix MySql PHP PDO Error HY093

I’ve been working with PDO at my new job and encountered this HY093 error. Infact that was the only information I received back from my PDO object. Usually there is a lot more information. My guess is that generally PDO is passing back the MySQL error directly from the MySQL server. However, HY093 is strictly an error issued by PDO.

In this case I received the HY093 error because I had improperly binded a data type to a variable.

I was using the form:

$db->prepare("SELECT * FROM tbl WHERE name = :name");
$pdo->bindValue(':name',$phpVar,PARAM_STR);
$pdo->execute();

Notice on line 2 I used “PARAM_STR” this should be PDO::PARAM_STR likewise had this been an integer it would have been PDO:PARAM_INT. Hopefully that helps some people.

Drop me a comment if this helped your or if you feel I missed something, thanks for reading.

Related posts:

  1. Using perror to Help Debug Mysql Errors
  2. using firephp to debug php web applications
  3. Use MySQL HAVING to Get Past Error 1111 Invalid Use of Group Function
  4. setting up iis7 w/ mysql and php
  5. Optimize MySQL Queries – Fast Inserts With Multiple Rows

Tags: , , ,

2 Responses to “What is PDO Error HY093: Debug/Fix MySql PHP PDO Error HY093”

  1. gogol says:

    i have this same problem. but i cant solve it. var_dump show me everythings fine. i dont have idea what is going wrong..

  2. jdboss says:

    try $pdo->bindValue(‘name’,$phpVar,PARAM_STR);

Leave a Reply