md5 condition with table column

Hello Team

I am getting stuck with making condtion with md5 value. I have id in md5 fomat and want to match with id column in table. I would like to have query like : find("md5(id) = $id").

But i am not getting success, please help me asap.

Thanks!



60.8k

i am not 100% sure but u probably need to wrap it in raw Value

https://docs.phalconphp.com/en/latest/api/Phalcon%5Db%5RawValue.html

Why not using php's md5 function?

$foo = md5($id);
$result = Robots::find("id = '" . $foo . "'");

or using parameters:

$foo = md5($id);

$conditions = "id = :id:";

$parameters = array(
    "id" => $foo
);

$results = Robots::find(
    array(
        $conditions,
        "bind" => $parameters
    )
);