ora_bind not binding properly

I am having trouble getting a variable ($OrderNum) to bind to a sql query variable(:ordernum) in php. When I try and run it, it spits out an error saying that "Warning: ora_exec(): Can't find variable for parameter in .../header.inc on line 61 Warning: ora_getcolumn():", and if I take out the ora_bind statement and hard code a value in the statement, then it works just fine. My question is, what am I doing wrong? Am I doing anything wrong? How would I go about fixing it if I am doing anything wrong?

Relevant code

sql code

WHERE ORDER_NUMBER = :ordernum

php

ora_parse($curs2,$sales_sql_statement);
ora_bind($curs2,"OrderNum",":ordernum",15,1);
$OrderNum=$intOrderNum;
ora_exec($curs2);

Upvotes: 1

Views: 53

Answers (1)

Turns out it was that I had to not only define the variable beforehand, but I also had to add global in front of the variable declaration since it was inside a function.

Upvotes: 1

Related Questions