Bug #48301 [Opn->Csd]: odbc_fetch_array() return error

From: Date: Sat, 11 Apr 2015 14:35:09 +0000
Subject: Bug #48301 [Opn->Csd]: odbc_fetch_array() return error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191965@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=48301&edit=1

 ID:                 48301
 Updated by:         cmb@php.net
 Reported by:        rmbaba at gmail dot com
 Summary:            odbc_fetch_array() return error
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            ODBC related
 Operating System:   ubuntu 9.4
 PHP Version:        5.2CVS-2009-05-16 (CVS)
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php




Previous Comments:
------------------------------------------------------------------------
[2009-06-06 12:52:10] rmbaba at gmail dot com

SO any updates about this bug please?

------------------------------------------------------------------------
[2009-05-17 04:43:28] Eric at juhaynum dot com dot br

Hi I'm getting the same error, it ask me to download the file..

------------------------------------------------------------------------
[2009-05-16 10:34:55] rmbaba at gmail dot com

Description:
------------
Hello,

I just prepared the server, installed apache, php5 mysql and odbc, I configured the the required
files as well , and here is the result when I trying to connect to MS Access database:

+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> select * from table;
lablablab...

Here is a small php code:

$conn = odbc_connect("DSN","",""); $select = "SELECT * FROM
TABLE"; $result = odbc_exec($conn, $select); while ($row = odbc_fetch_array($result)) { $rowid
= $row['name1']; $pwd = $row['password']; } echo "Row id :".$rowid;
echo "password : ".$pwd;


The problem is, when I browse the file it as me to download it instead of explorer it, although the
other projects with php and mysql are working well.

Reproduce code:
---------------
Here another small code after the tracing:

$db = odbc_connect("LOIR","","",SQL_CUR_USE_ODBC);
if (!$db) {
  die('ERROR: Cannot connect!');
}

$sql = "SELECT * FROM st_student";
$result = odbc_exec($db, $sql) or die('ERROR: Cannot execute query!');
if (!$result)
{
    exit("Error in SQL: ".$sql);
}

until now everything is okay unless this while array:

while (odbc_fetch_array($result))
{
 echo odbc_result($result,"name1");
}
odbc_close($db);

Warning: odbc_fetch_array() [function.odbc-fetch-array]: No tuples available at this result index in
/var/www/access.php on line 14

Although when I replace the above fetch array with this:

$row = odbc_fetch_array($result);
echo $row["name1"];
odbc_close($db);

it return one row and when field.

Expected result:
----------------
It supposed to return all 300 records in the database.

Actual result:
--------------
I don't have backtrace..

and I would appreciate your cooperation with this matter, because I'm tired now from it, since
4 days and I'm googling but no result.

Cordially,


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=48301&edit=1


Thread (4 messages)

« previous php.bugs (#191965) next »