I am having a variable $query1
and in this, I have a query string and in this query string, I have used another variable $sORp
. The main problem is that I want to give this $sORp
variable a value at runtime without changing my string variable holding the query. Is this possible?
Code Snippet is as below(dummy example):
$query1="SELECT $sORP,name from table1
where $sORp=:SRC_NAME
group by $sORp,name
order by $sORp";
I want to assign this variable $sORp
"SRC" and "POOL" at run time as I don't want to write query twice with different values.
Use in code:
$sORp='SRC';
$sql=$query1;
$sth = oci_parse($con,$sql);
And this is not working, Is there any solution for this.
And on running this PHP file the error is: ORA-00936: missing expression