Closed DaveSanchez closed 6 years ago
I think you can't use update method. My suggestion, you can use query method with prepared statement like this
$database->debug()->query(
"UPDATE users SET user_password=:passwordnya WHERE md5('iduser')=:idnya", [
":passwordnya" => "this is passwordnya",
":idnya" => "this is id user"
]
)->fetchAll();
Check out the new feature raw object https://medoo.in/api/raw.
I'm hashing all my database ids for a more secure application, but I need to write queries like this:
UPDATE "users" SET "user_password" = '$2y$10$uCCGApw.KSarq17DhHtXse.BNswdUWP/X9W87kCCzkU2q9XytZX.a' WHERE md5("iduser") = 'c4ca4238a0b923820dcc509a6f75849b'
How could be this possible?, I wrote the next code but it's not generating what I want to:
$this->_app['medoo']->debug()->update('users',[ 'user_password' => $password ],[ 'md5(
iduser)' => $user ]);
outputs:
UPDATE "users" SET "user_password" = '$2y$10$c7/8miGJ9zhUKDQherY0J.j4NiL4DE2ShfNIcvUUSl63yj3hSpENS' WHERE "md5" = 'c4ca4238a0b923820dcc509a6f75849b'
Please help!