Re: foreach OCIBindByName()
| From: | Butler, Shaun | Date: | Wed, 14 Feb 2001 14:08:55 +0000 |
| Subject: | Re: foreach OCIBindByName() | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-39715@lists.php.net to get a copy of this message | ||
On Wednesday 14 February 2001 17:55, you wrote:
> On Wed, Feb 14, 2001 at 12:35:10PM +0000, Butler, Shaun wrote:
> > So I want to bind multiple values that are in an associative array
> >
> > I have this code
> >
> >
> > foreach ($binds as $key=>$value)
> > {
> > OCIBindByName($this->m_cursor,":$key",$value,-1);
> > }
> >
> > but it only seems to work for one value in the array, the array conetents
> > would be something like
> >
> > $binds["id"] = 54;
> > $binds["name"] = Dick;
> >
> > anyone get this to work or have any idea why it works when the array only
> > has one thing in it? Thanks in advance
>
> the values bound by ocibindbyname are "taken" from
> script-space when you call ociexecute() and then $value will
> have only one value.
>
> tc
in case anyone needs this I fixed it by doing this
foreach ($binds as $key=>$value)
{
$$key = $value;
OCIBindByName($this->m_cursor,":$key",$$key,-1);
}
thanks tc
--
Shaun Butler
sbutler@internet.com
x2905