php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19982 select from multiple tables fail
Submitted: 2002-10-18 13:17 UTC Modified: 2002-11-06 10:26 UTC
From: pptiezzi at erreuno dot net Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.2.3 OS: RedHat 6.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pptiezzi at erreuno dot net
New email:
PHP Version: OS:

 

 [2002-10-18 13:17 UTC] pptiezzi at erreuno dot net
I'm using Openlink Multi Tier Driver for accessing a Informix 7.2 Database on a Linux box from PHP scripts running on the Apache Web Server on a different Linux Box.
PHP version 4.2.3
Openlink version 4.2.7
Apache Version 1.3.12
I'm tested Openlink driver and DSN setup with Openlink test program odbctest: It work fine.

This script work fine:
<?
$db = odbc_connect("$dsn", "$user", "$password");
$sql = "Select codice,name,address from clienti where codice = '$codice'";
if($result = odbc_do($db, $sql))
  {if($db1 = odbc_fetch_into($result, $myrow))
     do{printf("
         ........     
       }while((odbc_fetch_into($result, $myrow));
   }
?>
This script fail... (The same sql statement work fine with odbctest)
<?
$db = odbc_connect("$dsn", "$user", "$password");
$sql = "Select codice,name,address, zipnum from clienti, ziptable where codice = zipcode and codice = '$codice'";
if($result = odbc_do($db, $sql))
  {// The $result connect string is OK and the correct
   // number of rows is returned....
   $numrows = odbc_num_rows($result); // O.K.
   // Nothing is returned from the following function..
   if($db1 = odbc_fetch_into($result, $myrow))
     do{printf("
         ........     
       }while((odbc_fetch_into($result, $myrow));
   }
?>
odbc_fetch_row also returns nothing.

PHP configuration:
./configure' '--with-apxs=/usr/sbin/apxs' '--with-ftp' '--with-config-file-path=/etc/httpd' '--with-informix' '--with-iodbc=/usr/local/openlink/odbcsdk'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-18 13:30 UTC] kalowsky@php.net
hrm, any chance you can turn on SQL logging?
 [2002-10-21 02:37 UTC] pptiezzi at erreuno dot net
**** The SQL log **** 

[0] SQLAllocHandle
handleType=1
[0] SQLAllocHandle: returning SQL_SUCCESS
[0] SQLSetEnvAttr hEnv=DBD0001
Attribute=200 ValuePtr=2 StringLength=0
[0] SQLSetEnvAttr: returning SQL_SUCCESS
[0] SQLAllocHandle hEnv=DBD0001
handleType=2
[0] SQLAllocHandle: returning SQL_SUCCESS

[0] SQLConnect hDbc=DBD0002
szDSN=820012C cbDSN=-3 szUID=8200114 cbUID=-3 szPWD=82000FC cbPWD=-3
DSN=gaia;UID=gaeuro;PWD=erre1
connStr=[DSN]
  key=[DSN] data=[gaia] supplied=1
  key=[DATABASE] data=[/usr/serv1/gaeuro/exe/dbgaia/gaia] supplied=0
  key=[OPTIONS] data=[] supplied=0
  key=[UID] data=[gaeuro] supplied=1
  key=[READONLY] data=[] supplied=0
  key=[HOST] data=[10.30.0.33] supplied=0
  key=[PORT] data=[5000] supplied=0  key=[SVT] data=[Informix 7.2] supplied=0
  key=[FBS] data=[99] supplied=0
  key=[NLB] data=[Yes] supplied=0
  key=[PROTO] data=[TCP/IP] supplied=0
  key=[DLF] data=[] supplied=0
cn_dbpath=[/usr/serv1/gaeuro/exe/dbgaia/gaia] cn_dbopts=[] cn_readonly=0
cn_fetchSize=99 cn_dbhost=[10.30.0.33] cn_svtype=[Informix 7.2]
cn_deferlongfetch=0
cn_needbind=1
cn_hasMoreRes=1
cn_hasParamOp=0
cn_hasScrlCurs=1
cn_hasDynMixCurs=0
cn_hasV2DAE=0
cn_spOutDeferFetch=0
cn_hasExecute2=0
autocommit=1
[0] SQLConnect: returning SQL_SUCCESS

[0] SQLGetInfo hDbc=DBD0002
fInfoType=23 rgbInfoValue=81F6CA4 cbInfoValueMax=2 pcbInfoValue=0
[0] SQLGetInfo: returning SQL_SUCCESS

[0] SQLGetInfo hDbc=DBD0002
fInfoType=24 rgbInfoValue=81F6CA6 cbInfoValueMax=2 pcbInfoValue=0
[0] SQLGetInfo: returning SQL_SUCCESS

[0] SQLAllocHandle hDbc=DBD0002
handleType=3
[0] SQLAllocHandle: returning SQL_SUCCESS

[0] SQLGetStmtAttr hStmt=DBD0003
Attribute=10010 ValuePtr=081F98C4 BufferLength=0 StringLengthPtr=00000000
[0] SQLGetStmtAttr: returning SQL_SUCCESS

[0] SQLGetStmtAttr hStmt=DBD0003
Attribute=10011 ValuePtr=081F98EC BufferLength=0 StringLengthPtr=00000000
[0] SQLGetStmtAttr: returning SQL_SUCCESS

[0] SQLGetStmtAttr hStmt=DBD0003
Attribute=10012 ValuePtr=081F9914 BufferLength=0 StringLengthPtr=00000000
[0] SQLGetStmtAttr: returning SQL_SUCCESS

[0] SQLGetStmtAttr hStmt=DBD0003
Attribute=10013 ValuePtr=081F993C BufferLength=0 StringLengthPtr=00000000

[0] SQLGetStmtAttr: returning SQL_SUCCESS

[0] SQLGetInfo hDbc=DBD0002
fInfoType=8 rgbInfoValue=BFFFDA1C cbInfoValueMax=4 pcbInfoValue=0
[0] SQLGetInfo: returning SQL_SUCCESS

[0] SQLSetStmtAttr hStmt=DBD0003
Attribute=6 ValuePtr=00000002 StringLength=0
[0] SQLSetStmtAttr: returning SQL_SUCCESS_WITH_INFO

[0] SQLExecDirect hStmt=DBD0003
szSqlStr=81F9204 cbSqlStr=-3
  [Select a_sigla_art, a_descr_art, sc_descr from art, sco where sc_cod_s_conto=a_cod_forn]
[0] SQLExecDirect: returning SQL_SUCCESS

[0] SQLNumResultCols hStmt=DBD0003
pccol=BFFFD9CA
[0] SQLNumResultCols: returning SQL_SUCCESS

[0] SQLNumResultCols hStmt=DBD0003
pccol=BFFFD9DA
[0] SQLNumResultCols: returning SQL_SUCCESS

[0] SQLColAttribute hStmt=DBD0003
icol=1 fDescType=1011 rgbDesc=081F995C cbDescMax=32 pcbDesc=BFFFD9FE pfDesc=00000000
[0] SQLColAttribute: returning SQL_SUCCESS

[0] SQLColAttribute hStmt=DBD0003
icol=1 fDescType=2 rgbDesc=00000000 cbDescMax=0 pcbDesc=00000000 pfDesc=081F9984
[0] SQLColAttribute: returning SQL_SUCCESS

[0] SQLColAttribute hStmt=DBD0003
icol=1 fDescType=6 rgbDesc=00000000 cbDescMax=0 pcbDesc=00000000 pfDesc=BFFFD9F8
[0] SQLColAttribute: returning SQL_SUCCESS

[0] SQLBindCol hStmt=DBD0003
icol=1 fCType=1 rgbValue=81F8E3C cbValueMax=19 pcbValue=81F9980
[0] SQLBindCol: returning SQL_SUCCESS

[0] SQLColAttribute hStmt=DBD0003
icol=2 fDescType=1011 rgbDesc=081F9988 cbDescMax=32 pcbDesc=BFFFD9FE pfDesc=00000000
[0] SQLColAttribute: returning SQL_SUCCESS

[0] SQLColAttribute hStmt=DBD0003
icol=2 fDescType=2 rgbDesc=00000000 cbDescMax=0 pcbDesc=00000000 pfDesc=081F99B0
[0] SQLColAttribute: returning SQL_SUCCESS

[0] SQLColAttribute hStmt=DBD0003
icol=2 fDescType=6 rgbDesc=00000000 cbDescMax=0 pcbDesc=00000000 pfDesc=BFFFD9F8
[0] SQLColAttribute: returning SQL_SUCCESS

[0] SQLBindCol hStmt=DBD0003
icol=2 fCType=1 rgbValue=81F9AAC cbValueMax=41 pcbValue=81F99AC
[0] SQLBindCol: returning SQL_SUCCESS

[0] SQLColAttribute hStmt=DBD0003
icol=3 fDescType=1011 rgbDesc=081F99B4 cbDescMax=32 pcbDesc=BFFFD9FE pfDesc=00000000
[0] SQLColAttribute: returning SQL_SUCCESS

[0] SQLColAttribute hStmt=DBD0003
icol=3 fDescType=2 rgbDesc=00000000 cbDescMax=0 pcbDesc=00000000 pfDesc=081F99DC
[0] SQLColAttribute: returning SQL_SUCCESS

[0] SQLColAttribute hStmt=DBD0003
icol=3 fDescType=6 rgbDesc=00000000 cbDescMax=0 pcbDesc=00000000 pfDesc=BFFFD9F8
[0] SQLColAttribute: returning SQL_SUCCESS

[0] SQLBindCol hStmt=DBD0003
icol=3 fCType=1 rgbValue=81F6D5C cbValueMax=31 pcbValue=81F99D8
[0] SQLBindCol: returning SQL_SUCCESS

[0] SQLRowCount hStmt=DBD0003
pcrow=BFFFDA24
[0] SQLRowCount: returning SQL_SUCCESS

[0] SQLExtendedFetch hStmt=DBD0003
fFetchType=1 irow=0 pcrow=BFFFDA1C rgfRowStatus=BFFFDA22
[0] SQLExtendedFetch: returning SQL_ERROR

[0] SQLExtendedFetch hStmt=DBD0003
fFetchType=5 irow=1 pcrow=BFFFDA1C rgfRowStatus=BFFFDA22
[0] SQLExtendedFetch: returning SQL_NO_DATA_FOUND

[0] SQLExtendedFetch hStmt=DBD0003
fFetchType=1 irow=0 pcrow=BFFFDA1C rgfRowStatus=BFFFDA22
[0] SQLExtendedFetch: returning SQL_NO_DATA_FOUND

[0] SQLExtendedFetch hStmt=DBD0003
fFetchType=5 irow=1 pcrow=BFFFDA1C rgfRowStatus=BFFFDA22
[0] SQLExtendedFetch: returning SQL_NO_DATA_FOUND
[0] SQLFreeHandle hStmt=DBD0003
handleType=3
[0] SQLFreeHandle: returning SQL_SUCCESS

[0] SQLDisconnect hDbc=DBD0002
[0] SQLDisconnect: returning SQL_SUCCESS
 [2002-11-06 03:49 UTC] cvb at clausvb dot de
Notes:
'--with-informix'

Imho it should be "-with-informix=yes". But if you make (make install) worked, that should be no problem.

Why do you use a
=> $db = odbc_connect("$dsn", "$user", "$password");
if you could use a
=> $connect = ifx_connect("$database@IFX_SERVER", "$user", "$password");
?

To your problem:
What happens if you run the statment:
"Select codice,name,address, zipnum from clienti, ziptable where codice = zipcode and codice = '$codice'"
in DBACCESS?

Please give me examples for "codice", "zipcode" and "$codice". (Since JOIN here.)

"This script fail..."
I assume there is no error?

Regards,
Claus
 [2002-11-06 09:53 UTC] pptiezzi at erreuno dot net
To solve this problem:
Edit php_odbc.h and delete all rows
'#define  HAVE_SQL_EXTENDED_FETCH 1'
and recompile PHP.
 [2002-11-06 10:26 UTC] kalowsky@php.net
Note your solution is typically a Bad Idea (TM).  The configure script should detect if a system is capable of handling a SQLExtendedFetch or not.  

While I know that iODBC does support the ExtendedFetch (thus it works for your issue), it preplexes me that it does not find the EXTENDED_FETCH flag in your build.  You should note that ext/odbc/php_odbc_includes.h does pretty much the same solution...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 18:01:31 2024 UTC