This topic is locked

MSSQL Query returning only 1 row

2/27/2008 12:02:15 PM
PHPRunner General questions
S
spintz author

A simple query - SELECT userid, name FROM users;
The users table has 43 rows in it. This query, run from a BeforeProcessList event, returns only 1 row. If I exectue this query directly in MSSQL it returns, as expected, 43 rows. Any clue as to why this would only return 1 record?

S
spintz author 2/27/2008

No matter which table I query, and no matter my where clause( I've added "WHERE userid > -1" ) and still ONLY 1 row is ever returned. Is there something static in the connection?

S
spintz author 2/27/2008

No matter which table I query, and no matter my where clause( I've added "WHERE userid > -1" ) and still ONLY 1 row is ever returned. Is there something static in the connection?


The problem is that the RecordCount is -1. The db_numrows function, in this case, will return 1. I have no idea why RecordCount is -1, looking into it.

S
spintz author 2/27/2008

I've added this function as a workaround for now -

function db_myNumRows($qhandle)

{

$count = 0;

while( !$qhandle->EOF() )

{

$count++;

$qhandle->MoveNext();

}

$qhandle->MoveFirst();

return $count;

}


But I don't get why -1 is being returned in the RecordCount attribute....