From:             rmbaba at gmail dot com
Operating system: ubuntu 9.4
PHP version:      5.2CVS-2009-05-16 (CVS)
PHP Bug Type:     Output Control
Bug description:  odbc_fetch_array return error

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 bug report at http://bugs.php.net/?id=48301&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48301&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48301&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48301&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48301&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48301&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48301&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48301&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48301&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48301&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48301&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48301&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48301&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48301&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48301&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48301&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48301&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48301&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48301&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48301&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48301&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48301&r=mysqlcfg

Reply via email to