$Query = pg_query_params($db, 'SELECT username FROM users WHERE id = $1 AND password=(crypt(\'$2\',password)) LIMIT 1', array(33,'thepassword'));
"bind message supplies 2 parameters, but prepared statement "" requires 1"
The problem seem around the '$2' parameter, heredoc string doesnt works.
Suggestions ?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With