簡體   English   中英

Zend_Db更新問題

[英]Zend_Db Update issues

嘿,我有以下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`

我想在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);

它不起作用,沒有錯誤,什么也沒有...從$ db轉儲是這個...

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

試試這個數組符號:

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

參考(示例#24)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM