Results 1 to 2 of 2
  1. #1

    Smile local to remote database problem


    guys,,

    do u have any idea on how to collect local database data into an array and paste it into the remote database. here's my sample code:

    -------------------------------------------------------------------------------------------------
    //this is the local database

    $dbhost = "localhost";
    $dbuser = "root";
    $dbpass = "";
    $dbname= "mydb";

    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ("Error connecting to database of the localhost...");
    mysql_select_db($dbname);

    $query = mysql_query("SELECT * FROM dbuser");

    $row = mysql_fetch_array($query);

    $name = $row['lname'];

    echo $name;

    //this is the remote database
    $dbhost1 = "mysql";
    $dbuser1 = "myuser";
    $dbpass1 = "mypass";
    $dbname1 = "mydblocal";

    $conn = mysql_connect($dbhost1, $dbuser1, $dbpass1) or die ("Error connecting to database of the remote...");
    mysql_select_db($dbname1);

    -------------------------------------------------------------------------------------------------

    is it possible pls.. help.. tanx...

  2. #2
    Elite Member
    Join Date
    Jun 2010
    Gender
    Male
    Posts
    1,018
    use another variable for the second connection kay mawala ang reference sa first connection.

    first query from the local connection...

    you then either...

    extract the data from the entire resultset or extract the data one row at a time
    then transfer to the other db by embedding the data
    either into a batch insert or a simple insert.

  3.    Advertisement

Similar Threads

 
  1. append local table to remote table
    By c-chan in forum Programming
    Replies: 2
    Last Post: 08-05-2010, 09:25 AM
  2. Replies: 2
    Last Post: 04-21-2010, 11:15 AM
  3. Is suicide the answer to our LOVE problem?
    By tinta in forum "Love is..."
    Replies: 452
    Last Post: 08-10-2006, 12:02 AM
  4. Replies: 20
    Last Post: 05-18-2006, 06:12 AM
  5. I want a Freeware Utility to ... 450+ common problems solved
    By ares623 in forum Websites & Multimedia
    Replies: 3
    Last Post: 05-06-2006, 07:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top