Not fetching all expected rows

Permalink
Hey all! I got a tricky one for you. When I do this:

$us = new UserSearch(array('uak_2' => 'Investor'));
$res = $us->getResult('uName',0,'asc');
echo '<!-- DEBUG: ', $us->total, " -->\r\n";


I get 23, which is correct. However, when I do this:

$total = 0;
while ($row = $res->fetchRow()) {
$total++;
}
echo '<!-- DEBUG: ', $total, " -->\r\n";


I only get a count of 20. I have no idea what is happening to the other three rows. Has anyone seen this before? I could use a hand debugging this. I'm currently using version 5.3.2.

Thanks!

Darkwater23
 
Mnkras replied on at Permalink Reply
Mnkras
#1 upgrade
#2 what exactly are you trying to do? get the number of users with a certain attribute?
Darkwater23 replied on at Permalink Reply
Darkwater23
Thanks for responding. I can't do an upgrade just yet. I'm in the middle of a project. Once the project is complete, I can look at upgrading to the newest version and doing regression testing.

What I'm trying to do is loop over all the users with a certain attribute and value and then run a query for each one. I thought maybe the query was bombing, but that's not the case. The user search collection appears to have 23 users in it, but when I loop, there's only 20. Any idea why?

Thanks!
jordanlev replied on at Permalink Reply
jordanlev
I would check the database itself (if you can figure out the schema for user attributes) -- that may give you some insight as to what's going on. Maybe user data is versioned like files and pages, and one query is pulling those who currently have the attribute while the other is pulling anyone who's ever had the attribute? I dunno... But find out what the real number is supposed to be and work backwards from there.
Darkwater23 replied on at Permalink Reply
Darkwater23
Thanks for responding!

That's what I'm working on now. I tore into the UserSearch class and reconstructed the query it is using. The query was fine and it returned the correct users (23 total). It seems like the while loop is where the issue it. Maybe there's an error when trying to copy the object to the row variable? I'm not sure. I was hoping a C5 uber dev guy might have run into this before. If push comes to shove, I'll replace the UserSearch with a standard query and see if I can just while loop over the recordset that way.