This is my first question on StackOverflow, can you please explain to me what I am doing wrong from: I have this code (below) but for some reason, that I have tried to look into and debug, I cannot see why PDO is not completing the request below, it works fine the same way for inserting and echoing, can someone please tell me what’s going on? I am pulling my hair out of my head in frustration.
$q = "UPDATE content SET urlid=:url, title=:title, description=:desc, keywords=:key WHERE urlid=:urlid";
$query = $pdo->prepare($q);
$query->execute(array(
':url' => $urlid,
':title' => $title,
':desc' => $desc,
':key' => $key,
':contloc' => $contloc,
':userid' => $uid,
':urlid' => $urlid
//':content' => $content
));
I receive the following warning in my Apache error log:
[Thu Jul 12 21:07:13 2012] [error] [client 99.230.122.54] PHP Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in /Library/Server/Web/Data/Sites/Default/addto2.php on line 31, referer:
http://localhost/sample/4fff30aea1f20
PDO complains because you are passing more arguments than you are using in your query. Or perhaps you meant to include more arguments in your query and you forgot?