I connected Mysql & Oracle databases through php.
Now in one function say dbInsert(), I have store data inserted in mysql database in one variable. Now I close connection with Mysql.
Then I open connectio for Oracle database & trying to get that variable so that I can insert those value in Oracle.
But problem I am not getting those Mysql values in Oracle connection in that variable…
If I use it w/o function then file run fine but in class-function structure , it’s not working…
I have tried using global variable but effort in vain…
plz help…
I am posting only those functions as code is too large…
I have declared $str as global variable…& passing that in Oracle’s oradbInsert().
function dbFetch(){
$a = mysql_insert_id();
$result2 = mysql_query("SELECT * FROM sample where order_primary = $a");
while($row = mysql_fetch_array($result2)){$str = "'".$row["po_number"]."',"."'".$row[created_at]."',"."'".$row["ustomer_firstname"]."',"."'".$row["customer_lastname"]."',"."'".$row["customer_email"]."',"."'".$row["shipping_description"];
echo $str;}
function dbDisconnect()—-mysql disconnect
function oradbConnect()
function oradbInsert()
{
$qry1= "INSERT INTO Test(po_number , Po_creation_date , customer_firstname , customer_lastname , customer_email , shipping_description) values(".$str");
$p= oci_parse($conn,$qry1);
oci_execute($p);
}
So how should I pass $str from Mysql to Oracle so that data from Mysql will insert into Oracle…
Change the fetch function to return the values. Note: I made
$stran array, as you were fetching values in a loop. If you only selecting a single row, change this.Then pass the return value to the insert function. Again the note: I used an array here, if that is not needed, the code could be simpler.
Final note: This is not tested.