Hi is there a php function which creates the SQL for creating a table from an existing table? I mean similar to the phpmyadmin export function. Any idea anyone?
Do you mean basically copy a table structure only? CREATE TABLE tablename LIKE copythisone Code (markup):
What I am doing is basically write a web based application where you can connect to 2 database servers at the same time. You will be able to see all the databases and all tables and then you can copy a table or a database from one server to another without having to download anything.
$q = "CREATE TABLE tablename LIKE copythisone"; Code (markup): Erm there arent really any php functions for what you are talking about, you just need to figure it out in SQL, or you can pass mysql_query() a second parameter to say which specified which database handle to use $handle_db1 = mysql_connect("serverone","userone","passone"); $handle_db2 = mysql_connect("servertwo","usertwo","passtwo"); // give each handle it's own database to work with, permanently. mysql_select_db("tableone",$handle_db1); mysql_select_db("tabletwo",$handle_db2); $result1 = mysql_query($queryone, $handle_db1); $result2 = mysql_query($querytwo, $handle_db2); Code (markup):
Yeah I already got all that. I so far that I can browse both servers databases and select a table to copy to another database. Just need the creation query. Might have a look how phpmyadmin does it.