Error HY093 with a MySQL Insert PDO Request

You have a typo in one of your bindParams, which means you have a mismatch in parameters:

$sql->bindParam(":SocCoutry",$_POST["soc_pays"],PDO::PARAM_STR);

should be

$sql->bindParam(":SocCountry",$_POST["soc_pays"],PDO::PARAM_STR);

Here's an interesting case I found:

Running this query:

INSERT INTO videosubmissions (member_login, submission_date) VALUES (":login", ":submission-date")

Bound with:

[ ':login',           $info['login'],   PDO::PARAM_STR ],
[ ':submission-date', $submission_date, PDO::PARAM_STR ]

works... but

INSERT INTO videosubmissions (member_login, submission_date) VALUES (:login, :submission-date)

fails with an HY093 error. I suspected this was caused by the implicit conversion from string to date but trying an explicit STR_TO_DATE(format, sDate) didn't fix it. However if I quote all my placeholders in other queries with PDO::PARAM_STR value, it caused problems.

I know this doesn't really answer the Q but it adds another case to the mix to help figure out what's up.

Tags:

Php

Pdo