Closed (fixed)
Project:
Documentation
Component:
Correction/Clarification
Priority:
Minor
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
21 Sep 2011 at 11:45 UTC
Updated:
1 May 2014 at 12:30 UTC
Jump to comment: Most recent
Comments
Comment #1
Anonymous (not verified) commentedAre you sure your values for the title and type should actually return anything? I copy and pasted this and added variables above for $org_name and $type, and it worked for me.
Comment #2
phen commentedYes, it definitely returns results if I use the fetchCol() method.
In this case worked around it, not using rowCount(), but i continue to get this behavior with other completely different queries. It's not critical, so far I can work around it, but it's strange.
Any other ideas?
Comment #3
phen commentedUpdate:
RowCount() works on my production site but not on my local machine sandbox. So there must be some settings somewhere that disable it. Specs:
Production site:
MySQL 5.1.36
PHP 5.2.10
localhost:
MySQL 5.0.37
PHP 5.2.13
I wonder if upgrading MySQL on localhost would make a difference. It shouldn't, since it meets the minimum system requirements for D7. I don't think I have time to upgrade now, but I'll try it soon and report back.
Thanks for any input!
Comment #4
damien tournoud commentedPDOStatement::rowCount() is only guaranteed to return something for DELETE, INSERT, or UPDATE statements.
If you want to count a number of something, build a
COUNT(*)query using SelectQuery::countQuery().Comment #5
phen commentedThanks for the help!
Comment #6
phen commentedThe documentation at http://drupal.org/node/1251174 implies that result->rowCount() will work on a select query.
Can I suggest that the documentation be updated? I'd draft an edit myself but I'm not sure I understand the correct usage well enough yet...
More details:
The first line of the document is
Then later, without indicating that a different type of query is required:
Thanks!
Comment #7
jhodgdonThat page is incorrect. The documentation of the rowCount() method (and the comment above) are correct:
http://api.drupal.org/api/drupal/includes--database--database.inc/functi...
So the page should be corrected. Moving to correct issue queue.
If you would like to help, just click "Edit" at the top of that page and fix it. Thanks!
Comment #8
kristiaanvandeneyndeDone: http://drupal.org/node/1251174
Please review.
Comment #9
snufkin commentedI think its clear now.