ksmatthews Posted March 29, 2008 Share Posted March 29, 2008 HI Gurus, WE have recently migrated over to Postgre from mySQL. WE are using ODBC in case we change DB system again. I cannot get the ODBC function odbc_num_rows ($resource_id) to work. Here is my code ... $dbResult = odbc_connect( ... ); $SQL = "select password from sip_access where username='JOE'"; odbc_exec($dbResult, $SQL) $row = odbc_fetch_row($dbResult); echo 'Number of rows = ' . odbc_num_rows ($dbResult); It seems to return nothing ... In the documentation (php manual ) it states ... Note: Using odbc_num_rows() to determine the number of rows available after a SELECT will return -1 with many drivers. Does anyone have any suggestions ? regards, Steven M Link to comment https://forums.phpfreaks.com/topic/98473-odbc-function-odbc_num_rows/ Share on other sites More sharing options...
Phpnewbie23 Posted January 12, 2009 Share Posted January 12, 2009 Cheers had the bracket in my original code but moving it where you suggested worked brilliantly cheers its taken me nearly all day to figure that one out. ;D ;D How would you do the colouring of the text for success or fail. Cheers Link to comment https://forums.phpfreaks.com/topic/98473-odbc-function-odbc_num_rows/#findComment-735342 Share on other sites More sharing options...
revraz Posted January 12, 2009 Share Posted January 12, 2009 I think newbie replied to the wrong post. Anyways, you are trying to do your num_rows on your Connection. You need to do it on your Query result. HI Gurus, WE have recently migrated over to Postgre from mySQL. WE are using ODBC in case we change DB system again. I cannot get the ODBC function odbc_num_rows ($resource_id) to work. Here is my code ... $dbResult = odbc_connect( ... ); $SQL = "select password from sip_access where username='JOE'"; odbc_exec($dbResult, $SQL) $row = odbc_fetch_row($dbResult); echo 'Number of rows = ' . odbc_num_rows ($dbResult); It seems to return nothing ... In the documentation (php manual ) it states ... Note: Using odbc_num_rows() to determine the number of rows available after a SELECT will return -1 with many drivers. Does anyone have any suggestions ? regards, Steven M Link to comment https://forums.phpfreaks.com/topic/98473-odbc-function-odbc_num_rows/#findComment-735355 Share on other sites More sharing options...
Phpnewbie23 Posted January 12, 2009 Share Posted January 12, 2009 Whoops sorry :-[ :-[ Link to comment https://forums.phpfreaks.com/topic/98473-odbc-function-odbc_num_rows/#findComment-735361 Share on other sites More sharing options...
Mchl Posted January 12, 2009 Share Posted January 12, 2009 I doubt OP is still waiting for this answer... but maybe someone else will... I know for sure this function will not work with MS Access driver that is shipped with Office XP. Link to comment https://forums.phpfreaks.com/topic/98473-odbc-function-odbc_num_rows/#findComment-735376 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.