Number of affected rows Zend DB (UPDATE)

后端 未结 1 1959
北海茫月
北海茫月 2020-12-19 13:35

I\'m new to Zend Framework and I\'d like to know how I can get the number of affected rows from this:

$sql = \"UPDATE auth SET act=\'\', status=\'1\' WHERE u         


        
相关标签:
1条回答
  • 2020-12-19 14:11

    Zend_Db_Statement_Pdo has a rowCount() method.

    See the API docs

    Returns the number of rows affected by the execution of the last INSERT, DELETE, or UPDATE statement executed by this statement object.

    This means you can simply:-

    $rowsAffected = $stmt->rowCount();
    

    Straight after calling execute() and you should get the number of rows affected.

    0 讨论(0)
提交回复
热议问题