开发者

Specifying a db function in an insert statement in Zend

开发者 https://www.devze.com 2023-02-12 21:28 出处:网络
I have something like this: $data = array(\'use开发者_开发技巧rname\' => \'John\', \'password\' => \'john123\');

I have something like this:

$data = array('use开发者_开发技巧rname' => 'John', 'password' => 'john123');
$table = new Zend_Db_Table('users');
$table->insert($data);

But I want it to include a hashing function to the password, so the sql is something like this:

INSERT INTO `users` (`username`, `password`) VALUES ('John', PASSWORD('john123'));

How can I do that, elegantly?


$data = array('username' => 'John', 'password' => new Zend_Db_Expr('SHA1(john123)');
0

精彩评论

暂无评论...
验证码 换一张
取 消