我正在使用下面的php pdo代码插入数据到mysql数据库,插入成功,但是,更新后的数据库显示字符串文字'a',':b'作为值分别在现场。怎么了?php pdo绑定参数不起作用
$data = array( array('a' => 'John', 'b' => 'OK'), ); $st=$dbh->prepare("insert into mytable (a, b) values(':a', ':b')"); $st->execute($data) or print_r($st->errorInfo());
现在我得到$ st-> errorInfo()显示没有详细错误消息:数组 ( [0] => HY093 [1] => [2] => ) – user121196 2012-03-05 19:42:25
@ user121196我现在就看到它 - 当它应该是单个数组时,您有一个嵌套数组'$ data'。见上面的增加。 – 2012-03-05 19:45:14
我已经花了将近12个小时来尝试解决这个错误。谢谢你,@MichaelBerkowski! – IIllIIll 2015-10-18 22:36:58