Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7841743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:09:52+00:00 2026-06-02T16:09:52+00:00

In the MySQL docs, there is a note about using mysql_affected_rows after a transaction

  • 0

In the MySQL docs, there is a note about using mysql_affected_rows after a transaction commit:
http://php.net/manual/en/function.mysql-affected-rows.php

Note: Transactions
If you are using transactions, you need to call mysql_affected_rows() after your INSERT, UPDATE, or DELETE query, not after the COMMIT.

However, there is no such note on the PDOStatement::rowCount doc:
http://www.php.net/manual/en/pdostatement.rowcount.php

Does this mean the commit will not affect the affected rows count after INSERT, UPDATE or DELETE queries when using the PDO object?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:09:53+00:00Added an answer on June 2, 2026 at 4:09 pm

    A PDOStatement is returned for each query that is executed. You will be able to use PDOStatement->rowCount() at any time in your code (during or after a transaction and rollback/commit doesn’t matter). Each object takes care of maintaining itself.

    The reason mysql_affected_rows has that transaction note is because it is only aware of a single mysql connection resource. This means that when you complete the transaction (commit/rollback) a new query has been sent to the DB, thus altering which result is being processed for the number of affected rows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a statement in the MySQL Docs ( http://dev.mysql.com/doc/refman/5.0/en/adding-udf.html ) that is bothering
What does the MySQL USING statement do and is there any docs on this?
The MySQL manual (http://dev.mysql.com/doc/refman/5.1/en/charset-syntax.html) says: There are default settings for character sets and collations
Update 2022 There is cloud sql proxy now: https://cloud.google.com/sql/docs/mysql/sql-proxy#how-works Old Question I am currently
In MySQL's docs the following is said about the innodb_support_xa option: Enables InnoDB support
I've read much of the MySQL Cluster docs and some tutorials yet I still
MySQL connection in PHP can be established in two ways: $mysql = new mysqli('localhost',
I am trying to write a PHP-MySQL database processor that is somewhat intelligent. When
My background is in C and I've picked up PHP, mySQL, HTML, CSS without
Coming from MySQL and not knowing about ROLEs I absentmindedly tried this GRANT CREATE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.