Skip to content

Removed misleading example from rowCount() - #56

Closed
kamil-tekiela wants to merge 3 commits into
php:masterfrom
kamil-tekiela:master
Closed

Removed misleading example from rowCount()#56
kamil-tekiela wants to merge 3 commits into
php:masterfrom
kamil-tekiela:master

Conversation

@kamil-tekiela

Copy link
Copy Markdown
Member

The example given was confusing and misleading. If the purpose of it is to show how to get the count of matching records from the database then the example can be much shorter. query() should not be checked with if statement and there should not be 2 separate queries to the database if the actual count is not needed. If the number of fetched records is needed then you can simply use PHP's count() function.

The example given was confusing and misleading. If the purpose of it is to show how to get the count of matching records from the database then the example can be much shorter. `query()` should not be checked with `if` statement and there should not be 2 separate queries to the database if the actual count is not needed. If the number of fetched records is needed then you can simply use PHP's `count()` function.

@cmb69 cmb69 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

Comment thread reference/pdo/pdostatement/rowcount.xml Outdated
@kamil-tekiela
kamil-tekiela requested a review from cmb69 September 30, 2020 11:06

@cmb69 cmb69 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good to me.

@cmb69

cmb69 commented Oct 30, 2020

Copy link
Copy Markdown
Member
@cmb69 cmb69 closed this Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants