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 9310933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:14:17+00:00 2026-06-19T01:14:17+00:00

I have two mysql databases with the same structure in each. I want to

  • 0

I have two mysql databases with the same structure in each.

I want to take selected data from one db to the other.

One of the tables holds mutiple rows of data and I was looking at looping through the rows and doing inserts into the second db table but realised that as soon as I connect to the second db I will lose the connection to the first and the loop will fail.

Is the a robust and ‘proper’ way of doing theis rather than creating an array and then running an insert loop in the second db from the array?

currently I am using two different lots of credetials to access each db.

the API fuctons I am using are mysql_query and mysql_insert.

the reason i need to do this is I have a backend system that allows me to upload templates to the server, some are live and some are not.

the second db holds user details and details of any templates that they have selected.

btw I am working with php.

many thanks in advance and I hope I am not asking you to spoon feed me

cheers
Barry

  • 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-06-19T01:14:19+00:00Added an answer on June 19, 2026 at 1:14 am

    You are able to use 2 connections simultaneously by using $link_identifier parameter in mysql_* functions:

    $connection1 = mysql_connect('host1', 'user1', 'password1');
    $connection2 = mysql_connect('host2', 'user2', 'password2');
    
    ... 
    
    $resource = mysql_query('SELECT .....', $connection1);
    
    ...
    
    mysql_query('INSERT .....', $connection2);
    
    ...
    
    mysql_close($connection1);
    mysql_close($connection2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two databases. I want to dump data from one table in 1st
I have two mysql databases that have almost the same structure and representing the
I have two tables in MySql database, one is sales_order and the other is
I have two similar tables in different databases, I want to insert into one
I have two tables in my MySQL database, one is a library of all
In a MySQL database I have two tables linked in a join. One table
What I have is two tables inside of a mysql database. One table contains
I have a little problem. I have two MySQL databases, and I want to
I have two servers which contains a same database, same tables structure with different
I am trying to import data from a large database. I have two tables

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.