catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.83k stars 1.15k forks source link

md5 with Select Query Column #408

Closed somasish closed 6 years ago

somasish commented 8 years ago

Hi, i am 1st time user of Medoo i have a situation where md5 of a column equals a string. Something like this below. How can i do it using Medoo

$datas = $database->select("account", [ "user_name", "email" ], [ md5("user_id") => $SomeMd5String ]);

Thanks In Advance

catfan commented 8 years ago

How about this?

$datas = $database->select("account", [
        "user_name",
        "email"
    ], [
        "user_id" => md5($SomeMd5String)
    ]
);
somasish commented 8 years ago

Hi, Thanks for the reply, but the above solution will yield me double md5 of the string which equals to the user_id column in the query. We don't have decryptMd5 function but that will yield me perfect result. $datas = $database->select("account", [ "user_name", "email" ], [ "user_id" => decryptmd5($SomeMd5String) ] ); any possible way to handle through the medoo query. one possible way through programming is to fetch all user_id and convert to MD5 and compare. but it's not an effective way of programming

catfan commented 6 years ago

Check out the new feature raw object https://medoo.in/api/raw.