I am using zend framework and I see save() function used in the code, would like to know if there is a way to get the rows affected after this to see number of rows affected ..
I checked this documentation but din’t help much. any ideas? thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The Zend_Db_Table_Row::save() method returns the primary key of the row, either the current primary key if you’re updating an existing row, or a new primary key if you’re saving a new row.
The save() method applies to one row instance, so as @Evernoob says it should only apply to one row. But it doesn’t necessarily result in one row "affected" when you save. For instance, if I haven’t changed any column values, and I save() a row, the rows affected is zero. Try something like this in the mysql shell and you’ll see it reports zero rows affected.
The Zend_Db_Statement has a method
rowCount()(mimicking the PDOStatementrowCount()method), but this information is not surfaced through the Zend_Db_Table_Row interface.So if you need that information, you’ll have to update your data using Zend_Db_Adapter::query() to create a Zend_Db_Statement object. After you execute() the statement, you can call rowCount() on it.