php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15331 odbc_fetch_array gives a "Call to undefined function"
Submitted: 2002-02-01 14:16 UTC Modified: 2002-05-21 23:42 UTC
Votes:20
Avg. Score:4.5 ± 0.7
Reproduced:20 of 20 (100.0%)
Same Version:6 (30.0%)
Same OS:8 (40.0%)
From: tcurdt at dff dot st Assigned:
Status: No Feedback Package: ODBC related
PHP Version: 4.2.0 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-02-01 14:16 UTC] tcurdt at dff dot st
./configure' '--prefix=/usr/share' '--datadir=/usr/share/php' '--bindir=/usr/bin' '--libdir=/usr/share'
           '--with-config-file-path=/etc' '--with-exec-dir=/usr/lib/php/bin' '--with-sybase-ct=/opt/sybase' '--with-mysql=/usr' '--with-gd=yes'
     '--enable-gd-native-ttf' '--enable-gd-imgstrttf' '--with-tiff-dir=/usr' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6'
       '--with-ldap=yes' '--with-zlib=yes' '--with-bz2' '--with-gmp' '--with-xml' '--with-ttf' '--with-t1lib' '--with-mcal=/usr' '--with-imap=yes'
           '--with-sablot' '--with-ftp' '--with-ndbm' '--with-gdbm' '--with-mcrypt' '--with-gettext' '--with-mm' '--with-gd=yes' '--with-iodbc'
             '--enable-versioning' '--enable-yp' '--enable-bcmath' '--enable-trans-sid' '--enable-inline-optimization' '--enable-track-vars'
        '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-shmop' '--enable-calendar'
         '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-exif' '--enable-ftp' '--enable-memory-limit' '--enable-wddx' '--enable-filepro'
      '--enable-dbase' '--enable-ctype' '--disable-debug' '--enable-force-cgi-redirect' '--enable-discard-path' '--enable-sigchild' '--with-openssl'
                    '--with-imap-ssl' '--with-gd=yes' '--with-apxs=/usr/sbin/apxs' '--with-pgsql=/usr' '--with-snmp' 'i386-suse-linux'


Compiles fine. This should work:

<html>
<body>
<?php
$db = odbc_pconnect("TEST","test","test");
if($db){
  echo("success");
  $rs = odbc_exec($db, "select * from UDT_KUNDEN");
  $ar = odbc_fetch_array($rs);
  foreach ($ar as $key => $value) {
    echo "Key: $key; Value: $value<br>\n";
  }

  odbc_close($db);
}
?>
</body>
</html>

But I get "Call to undefine function".

I used iODBC + FreeTDS. Other ODBC function seem to work fine.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-23 11:06 UTC] phpbugs at gordimer dot net
Doesn't work either with php 4.2.0 on WinNT4 / Win2K, same error.
 [2002-04-24 04:26 UTC] christoph dot grottolo at gmx dot net
same error on winNT4 and winXPpro and PHP 4.2.0
 [2002-04-24 04:34 UTC] mfischer@php.net
odbc_fetch_array() is only available if compiled with --with-dbmaker support (note: not tested but that's what I gathered from reading the sources). Can you try this please ?
 [2002-04-24 11:12 UTC] Marcus dot Karlsson at usa dot net
It's possible to get odbc_fetch_array() and odbc_fetch_object() to work without DBMAKER. This is achieved by removing a few #ifdef's in the code:

php_odbc.h - line 216  => //#ifdef HAVE_DBMAKER
php_odbc.h - line 219  => //#endif
php_odbc.c - line 87   => //#ifdef HAVE_DBMAKER
php_odbc.c - line 90   => //#endif
php_odbc.c - line 87   => //#ifdef HAVE_DBMAKER
php_odbc.c - line 90   => //#endif
php_odbc.c - line 1229 => //#ifdef HAVE_DBMAKER
php_odbc.c - line 1280 => //#endif

I've tested this towards MySQL using MyODBC drivers and it seems to be working just fine.
 [2002-05-21 23:42 UTC] kalowsky@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2002-08-23 07:47 UTC] brunofr at ioda dot net
With php 4.2.2 Win32 binary from php.net unable to use the function ( undefine function call )
 [2003-04-13 20:00 UTC] eng at anrdaemon dot mtu-net dot ru
I found workaround for this function somewhere in internet, but this workaround NOT completely solve the problem.
For me, next code may be most usable (PHP 4.3):

function odbc_fetch_array($result, $rownumber=-1)
{
  if ($rownumber < 0) {
    odbc_fetch_into($result, $rs);
  }else
    odbc_fetch_into($result, $rs, $rownumber);
  foreach ($rs as $key => $value)
    $rs_assoc[odbc_field_name($result, $key+1)] = $value;
  if (isset($rs_assoc))
    return $rs_assoc;
  else
    return false;
};

while ($w2ta = odbc_fetch_array($w2rc))
  $w2fd[$i++] = $w2ta;
 [2003-05-12 18:55 UTC] prophet007 at hotmail dot com
This is a huge pain when you're trying to develop using MS SQL 2000... I've developed with MySQL and my employer wants to use MS SQL and now a bunch of code has to be rewritten because there isn't an equivalent way to run mysql_fetch_assoc... the fact that PHP.net says it should work in version 4.3.1 and it doesn't is even more aggrivating... just for the record, I'm running MS SQL Server 2000 on W2K with PHP version 4.3.1...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 13:01:29 2024 UTC