php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3117 ora_bind needs the variable it binds to be global
Submitted: 2000-01-06 10:55 UTC Modified: 2000-01-06 11:03 UTC
From: shaymandel at yahoo dot com Assigned:
Status: Closed Package: Oracle related
PHP Version: 3.0.12 OS: Linux
Private report: No CVE-ID: None
 [2000-01-06 10:55 UTC] shaymandel at yahoo dot com
function func($cur1) {
// the variable we get here is a cursor - declared in the calling function
// global $a; // if $a will not be declared global - it won't work	
$a = 1;	
ora_parse($cur1,"select * from t where a = :a");

	echo("$a");	
	ora_bind($cur1,"a",":a",11,ORA_BIND_IN); 
	ora_exec($cur1); // the parser says the error is in this line(336). The error is :Warning: Can't find variable for parameter in includes/search_functions.inc on line 336

However, if I unremark the above line - global $a; this will work fine.
	

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-01-06 11:03 UTC] thies at cvs dot php dot net
this is because the ora_bind() gets the name of the php-variable and has no clue about the current scope.
this is not going to change for the ora_*() functions - unless we find a volonteer.

the oci*() functions can bind php-vars directly - not thru their name and thereby don't have this restriction.

so: either declare all vars to be bound global, or use the oci-module.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 17:01:29 2024 UTC