pg_query_params return error: bind message supplies 2 parameters, but prepared statement “” requires 1

百般思念 提交于 2019-12-05 01:34:07

Single quotes are used in SQL for string literals. That means that this:

'$2'

is just a string that contains the characters $ and 2 rather than a placeholder. If you want a placeholder, you need to leave out the quotes:

$Query = pg_query_params($db, '...password=(crypt($2,password))...', array(33,'thepassword'));

That gives you the placeholder rather than the string literal.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!