Transfer data from one DB Server to another using PHP

How can I retrieve values from one database server and store them in other database server using PHP?

First off, please provide useful thread titles instead of meaningless ones, like “PHP Thread”. That means nothing, and it won’t get any interest for others to help you.

Now with that said, you would simply connect to database server A, query your data, connect to database server B, and insert your data. But all that is useless, when you can simply perform a mysqldump from database server A and import it into database server B.

What @cpradio; said is correct.

Easiest way is to do a mysqldump, or do an ‘Export’ from phpmyadmin if that’s available.

You can also fetch from one database and insert into another.

If you plan on doing this often, you might want to google for “php database migration” and “php database synchronization”. There are a few stand alone migration tools, and there are some powerful tools that include migration functionality.

Here are some links:
Phinx: http://phinx.org/
Yii Tool: http://www.yiiframework.com/doc/guide/1.1/en/database.migration
Propel (has built in migrations): http://propelorm.org/
Doctrine (can add migrations): http://www.doctrine-project.org/projects/migrations.html

Hope this get’s you pointed in the right direction :slight_smile: