Hi,
I'm trying to copy the data from a table in one database to another table (with the same fields of the origin table) in another database. And this is my code

$con= mysqli_connect("localhost", "root", "") or die("error");
        $sql="insert motcenter.d select * from mot_hrms.d ";
        $result=$con->query($sql);

But nothing happens when I run the code, or just few records copied with other tables.

I appriciate any help, and sorry for my poor english.

Recommended Answers

All 5 Replies

Why not download the table and upload it to other ?

INSERT INTO <DESTINATION TABLE NAME> SELECT * FROM <SOURCE TABLE NAME>

BUT FIELDS NAME AND TYPE OF DESTINATION SHOULD BE SAME AS SOURCE.

Thanks all
I figured out the problem

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.