#1062 export into php file

fixed
nobody
5
2013-06-11
2007-09-27
TheReality
No

It would be nice to export the complete database to a php file like:

<?php
// connection information
$ip = "***";
$user = "***";
$pass = "***";
$db_name = "***";
@MYSQL_CONNECT($ip,$user,$pass);
@MYSQL_SELECT_DB($db_name);

mysql_query("CREATE ........ ");
mysql_query("INSERT ........ ");

?>

So that I only have to insert the connection information. Than I can copy the hole file to the new webserver and execute it like.

http://www.newserver.de/tabelimport.php

Thanks very much.

NICE PROGRAM!!!!!!!!!!!!!!!!!!

Discussion

  • TheReality

    TheReality - 2007-09-27
    • summary: export php file --> export into php file
     
  • Sebastian Mendel

    Logged In: YES
    user_id=326580
    Originator: NO

    why not install phpMyAdmin on new server? or add the DB on the new server to you current phpMyAdmin installation?

     
  • James Hanley

    James Hanley - 2008-01-03

    Logged In: YES
    user_id=913645
    Originator: NO

    Installing phpMyAdmin on the other server would be the easiest solution. In the situation where one might want one installation to manage multiple servers can be complicated if two disjoint servers (from two different providers) block the port for mysql for external access. A workaround for this might be to encapsulated mysql protocol in http and have phpMyAdmin on network A and a simple protocol encapsulation php file on a server in network B. There would need to be some validation and security checks, but it would allow one installation to manage multiple disjoint locations where mysql port is blocked.

     
  • Julien G

    Julien G - 2008-05-13

    Logged In: YES
    user_id=2086059
    Originator: NO

    In my mind, the best would be to export datas as PHP ARRAY !

    --------------------- file : exported_data.php ----------------------
    <?php

    array(
    'myDB' => array(
    'firstTable' => array(
    array(
    'id' => 1,
    'name' => 'foo',
    'created_at' => '2008-07-06 05:04:03'
    ),
    array(
    'id' => 2,
    'name' => 'xyz',
    'created_at' => '2008-07-06 05:04:03'
    ),
    array(
    'id' =>3,
    'name' => 'bar',
    'created_at' => '2008-07-06 05:04:03'
    ),
    ),
    'secondTable' => array(
    array(
    'id' =>3,
    'name' => 'bar',
    'created_at' => '2008-07-06 05:04:03'
    ),
    ),
    ),
    );
    -----------------------------------------------------------------------

    It would be then easy to parse a database content, in PHP (instead of using CSV or XML as I actually do)

     
  • Michal Čihař

    Michal Čihař - 2008-09-03

    Logged In: YES
    user_id=192186
    Originator: NO

    phpMyAdmin has plugin system for export, you are free to come with code for this one. I think thad addopting SQL export to handle this should be pretty easy.

     
  • Marc Delisle

    Marc Delisle - 2010-01-02

    Exporting as PHP arrays implemented in 3.3.0.

     
  • Marc Delisle

    Marc Delisle - 2010-01-02
    • status: open --> closed
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: closed --> fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks