Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7667817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:12:05+00:00 2026-05-31T15:12:05+00:00

I connected Mysql & Oracle databases through php. Now in one function say dbInsert(),

  • 0

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…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:12:06+00:00Added an answer on May 31, 2026 at 3:12 pm

    Change the fetch function to return the values. Note: I made $str an array, as you were fetching values in a loop. If you only selecting a single row, change this.

    function dbFetch(){
      $a = mysql_insert_id();    
      $result2 = mysql_query("SELECT * FROM sample where order_primary = $a");
      $str = array();
      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"]."'";      
      } 
      return $str;
    }
    

    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.

    function oradbInsert($str){      
      $qry1= "INSERT INTO Test(po_number , Po_creation_date , customer_firstname , customer_lastname , customer_email , shipping_description) values(:val)";
      $p= oci_parse($conn,$qry1);
      oci_bind_by_name($p, ':val', $v);
      foreach ($str as $v) {
        oci_execute($p);
      }
     }
    

    Final note: This is not tested.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to return data fetched from MySQL table into a php file as
I' trying to get some data from Oracle via ODBC to mySQL database. And
Have a PHP/MySQL form with a dropdown box containing a list of 350 names.
I have an asp.net page connected to a MySql DB. When I try to
Right now I have a C++ client application that uses mysql.h to connect to
I have created a MySQL table where one of the columns stores a BLOB
Im coding a simple c/gtk+ app connected to a mysql database. The gui and
Both the MySQLi and MySQLi_STMT classes have an $insert_id property. If I am connected
Is that possible to connect mysql database between servers. I mean, lets say i
I have the MySQL Connector/NET installed on my PC. I modified the source code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.