|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-04-10 04:04 UTC] wohlfarth dot m at web dot de
$idresult2 = odbc_exec($iddb, $sqlqry2);
odbc_fetch_row($idresult2);
// Column 1 contains a string
if ( odbc_result($idresult2, 1) <> "" ) {
// Column 1 is now empty
echo odbc_result($idresult2, 1);
};
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 20:00:02 2025 UTC |
Complete Logfile is very long, here is the part of interest: 750-b24 ENTER SQLGetData HSTMT 00EC1DB0 UWORD 9 SWORD 1 <SQL_C_CHAR> PTR 0x053E8620 SQLLEN 4096 SQLLEN * 0x0595C5E4 750-b24 EXIT SQLGetData with return code 0 (SQL_SUCCESS) HSTMT 00EC1DB0 UWORD 9 SWORD 1 <SQL_C_CHAR> PTR 0x053E8620 [ 11] "521 (70074)" --> first odbc_result here SQLLEN 4096 SQLLEN * 0x0595C5E4 (11) 750-b24 ENTER SQLGetData HSTMT 00EC1DB0 UWORD 9 SWORD 1 <SQL_C_CHAR> PTR 0x053E9638 SQLLEN 4096 SQLLEN * 0x0595C5E4 750-b24 EXIT SQLGetData with return code 100 (SQL_NO_DATA_FOUND) --> ERROR here ??? HSTMT 00EC1DB0 UWORD 9 SWORD 1 <SQL_C_CHAR> PTR 0x053E9638 SQLLEN 4096 SQLLEN * 0x0595C5E4 750-b24 ENTER SQLExtendedFetch HSTMT 00EC1DB0 UWORD 1 <SQL_FETCH_NEXT> SQLROWOFFSET 1 SQLROWSETSIZE * 0x0520F318 UWORD * 0x0520F320 750-b24 EXIT SQLExtendedFetch with return code 0 (SQL_SUCCESS) HSTMT 00EC1DB0 UWORD 1 <SQL_FETCH_NEXT> SQLROWOFFSET 1 SQLROWSETSIZE * 0x0520F318 (1) UWORD * 0x0520F320 (0)Supplement... The error occures by: "SELECT List(ColumnX) as IDENT from TableA" you can bypass the problem when doing the following: "SELECT cast(List(Column) as varchar(1000)) as IDENT from TableA" Samplecode: <?php echo "Connect to database..."; $iddb = odbc_connect('db1','user1','user1'); echo "OK<br>"; if ( $iddb == 0 ) { echo "Error: Cannot connect to database."; exit; }; $sqlqry = "select List(ColumnA) as ColumnX from TableA"; echo "<hr>$sqlqry<br>"; $idresult = odbc_exec($iddb, $sqlqry); $qryeof = odbc_fetch_row($idresult); if ( !$qryeof ) { echo "no result"; } else { echo "Version 1 / Result 1: " . odbc_result($idresult, "ColumnX") . "<br><br>"; echo "Version 1 / Result 2: " . odbc_result($idresult, "ColumnX") . "<br><br>"; }; $sqlqry = "select cast(List(ColumnA) as varchar(1000)) as ColumnX from TableA"; echo "<hr>$sqlqry<br>"; $idresult = odbc_exec($iddb, $sqlqry); $qryeof = odbc_fetch_row($idresult); if ( !$qryeof ) { echo "no result"; } else { echo "Version 2 / Result 1: " . odbc_result($idresult, "ColumnX") . "<br><br>"; echo "Version 2 / Result 2: " . odbc_result($idresult, "ColumnX") . "<br><br>"; }; odbc_close($iddb); ?> Result of Samplecode: Connect to database...OK ------------------------------------------------------------ select List(ColumnA) as ColumnX from TableA Version 1 / Result 1: res1,res2,res3 Version 1 / Result 2: ------------------------------------------------------------ select cast(List(ColumnA) as VarChar(1000)) as ColumnX from TableA Version 2 / Result 1: res1,res2,res3 Version 2 / Result 2: res1,res2,res3