php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38310 odbc_fetch_row(): 8 is not a valid ODBC result resource
Submitted: 2006-08-03 10:05 UTC Modified: 2007-08-01 01:00 UTC
Votes:9
Avg. Score:4.6 ± 0.5
Reproduced:9 of 9 (100.0%)
Same Version:1 (11.1%)
Same OS:6 (66.7%)
From: suneelpro at rediffmail dot com Assigned:
Status: No Feedback Package: ODBC related
PHP Version: 5.1.4 OS: windows
Private report: No CVE-ID: None
 [2006-08-03 10:05 UTC] suneelpro at rediffmail dot com
Description:
------------
pls provide source code for connection to access and display the desired information (selecting of fields )in php.

Reproduce code:
---------------
function getListofPersonalDet()
 {$connect = odbc_connect("msaccess","root","root") or die("Couldn't connect to datasource."); 
	
echo $query = "select * from personal_details"; 
		
$result = odbc_prepare($connect,$query); 
odbc_execute($result); 
odbc_result_all($result,"border=1"); 
odbc_free_result($result); 
while (odbc_fetch_row($result)) {
for ($y = 1; $y <= odbc_num_fields($result); $y++) {
$arr[$x][$y] = odbc_result($result,$y);
$x++;
}
if ($x > 1)
 return $arr;
}
$arr=$result;
echo $arr[1][1]; 
}

Expected result:
----------------
array list of information framed in html using php

Actual result:
--------------
Warning: odbc_fetch_row(): 8 is not a valid ODBC result resource

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-24 15:30 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

And use the PDO ODBC instead, it has been reported to work much better.
 [2007-08-01 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 03 18:01:28 2024 UTC