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:
- Using perror to Help Debug Mysql Errors
- using firephp to debug php web applications
- Use MySQL HAVING to Get Past Error 1111 Invalid Use of Group Function
- setting up iis7 w/ mysql and php
- Optimize MySQL Queries – Fast Inserts With Multiple Rows
Tags: mysql, pdo, php, prepared statements
i have this same problem. but i cant solve it. var_dump show me everythings fine. i dont have idea what is going wrong..
try $pdo->bindValue(‘name’,$phpVar,PARAM_STR);