简体   繁体   English

Zend_Db更新问题

[英]Zend_Db Update issues

Hey I have the below SQL: 嘿,我有以下SQL:

UPDATE table_name`
SET opt_out = '1',
 opt_out_date = NOW(),
 admin_uid = '471',
 last_updated = now()
WHERE
    mem_uid = '7445093'
    AND opt_out = '0'
    AND verified = '0'
    AND reverted_credit_flag = '0'
ORDER BY
    id DESC
LIMIT 1`

Which I want reflect in PHP... 我想在PHP中反映...

 Zend_Db_Table::getDefaultAdapter();

$tableName = new Zend_Db_Table('table_name');

$data = array(
    'opt_out' => 1,
    'opt_out_date' => new Zend_Db_Expr('NOW()'),
    'admin_uid' => $admin_id,
    'last_updated' => new Zend_Db_Expr('NOW()')
);

$where = array(
    'mem_uid' => $mem_id,
    'opt_out' => '0',
    'verified' => '0',
    'reverted_credit_flag' => '0'
);

return $tableName ->update($data, $where);

It doesn't work and no error, just nothing... The dump from $db is this... 它不起作用,没有错误,什么也没有...从$ db转储是这个...

class Zend_Db_Adapter_Pdo_Mysql#149 (12) { protected $_pdoType => string(5) "mysql" protected $_numericDataTypes => array(16) { [0] => int(0) [1] => etc... class Zend_Db_Adapter_Pdo_Mysql#149(12){protected $ _pdoType => string(5)“ mysql” protected $ _numericDataTypes => array(16){[0] => int(0)[1] =>等等...

Try this array notation: 试试这个数组符号:

$where = array(
    'mem_uid = ?' => $mem_id,
    'opt_out = ?' => '0',
    'verified = ?' => '0',
    'reverted_credit_flag = ?' => '0'
);

Reference (Example #24) 参考(示例#24)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM