I've been working with mysqli prepared statements in PHP and have done many with no problems. Now I'm working on encrypting some previously plain-text passwords, and I need to use the mysql password() function in my query.
This is my code:
$stmt = $mysqli->prepare("select id from tm_users where login = ? and pwEnc = password(?)");
$stmt->bind_param('ss', $username, $password);
$stmt->execute();
$userdata = $stmt->get_result();
This code is generating the error:
PHP message: PHP Fatal error: Uncaught Error: Call to a member function bind_param() on bool in /var/www/...../test.php
If I remove the password function from the query, I don't get an error. But, of course, I need the function in order for the query to work properly!
Can somebody suggest what I should do to fix this?