php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15900 arguments to functions or again ODBC bug.
Submitted: 2002-03-06 10:09 UTC Modified: 2002-06-24 17:10 UTC
From: adasi at grubno dot da dot ru Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.1.2 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: adasi at grubno dot da dot ru
New email:
PHP Version: OS:

 

 [2002-03-06 10:09 UTC] adasi at grubno dot da dot ru
This function:
function GetTID($kid)
{
$a=$kid;
$conn = odbc_pconnect("$database", "$username", "$password");
$query = "select * from KontrahIO where KontrId2 = ".$kid;
$table = odbc_do($conn,$query);
$xi=1;
odbc_fetch_row($table);
while (odbc_fetch_row($table)) {
$tid[$xi]=odbc_result($table,9);
$a=$tid[$xi];
$xi++;
}
odbc_close($conn);
return $tid;
}

works but this one:

function GetTID($kid)
{
$database="Hetman";
$username="admin";
$password="pewnienie";
$conn = odbc_pconnect("$database", "$username", "$password");
$query = "select * from KontrahIO where KontrId2 = ".$kid;
$table = odbc_do($conn,$query);
$xi=1;
odbc_fetch_row($table);
while (odbc_fetch_row($table)) {
$tid[$xi]=odbc_result($table,9);
$a=$tid[$xi];
$xi++;
}
odbc_close($conn);
return $tid;
}

no... It's returning nothing


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-06 10:13 UTC] adasi at grubno dot da dot ru
In second first example i've cut lines with my example database name, user and password. In second one i forgot to do it. Of course the reason why it's not working is '$a=$kid;', not the database name/user/pass definitions.
 [2002-03-06 13:33 UTC] adasi at grubno dot da dot ru
Also:
echo odbc_result($table,5); 
works but
$tname=odbc_result($table,5); echo $tname; 
shows nothing.... dunno what to do, it's urgent.
unixODBC-2.2.1
FreeTDS-0.53
 [2002-06-24 17:10 UTC] kalowsky@php.net
Unable to reproduce any error with either of these versions.  If $kid is not being passed in as a variable through your function, that isn't a problem of the ODBC system.   Please add a print debug and see what your SQL query looks like before you execute it. 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 07:01:35 2025 UTC