Jump to content

ODBC function 'odbc_num_rows()'


ksmatthews

Recommended Posts

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

  • 9 months later...

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

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.