php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #348 NumRows returns -1
Submitted: 1998-05-05 09:34 UTC Modified: 1998-05-05 09:59 UTC
From: chris at naas dot no Assigned:
Status: Closed Package: ODBC related
PHP Version: 3.0 Release Candidate 4 OS: NT Server 4
Private report: No CVE-ID: None
 [1998-05-05 09:34 UTC] chris at naas dot no
We are using ODBC to connect to an Oracle 7.3 database
through Sql*Net (by Oracle).

Source example:

	$dd = odbc_connect("ORCL","news","news");
	$lars = odbc_exec($dd,"select ntb_header from ntb_news order by ntb_id desc");
	$numr = odbc_num_rows($lars);

$numr always returns -1. This is not correct.

odbc_result_all($lars);

prints out the correct result.

This problem also affects other functions, like

odbc_fetch_row($lars, $i);

if $i=1 it complains that:

Warning: Field index is larger than the number of fields in c:\apache\htdocs\news.phtml on line 18


.. and we are unable to get any data using any other
function than odbc_result()..



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-05-05 09:59 UTC] kara
From M$ ODBC API:

"For UPDATE, INSERT, and DELETE statements, pcrow is the number of rows affected by the
request or -1 if the number of affected rows is not available.
For other statements and functions, the driver may define the value of pcrow.
For example, some data sources may be able to return the number of rows returned by a 
SELECT statement or a catalog function before fetching the rows.
Note:
Many data sources cannot return the number of rows in a result set before fetching them;
for maximum interoperability, applications should not rely on this behavior."

Your Oracle driver is one of them.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC