0

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.

5
Contributors
5
Replies
29
Views
2 Weeks
Discussion Span
Last Post by Sana'a_1
0
INSERT INTO <DESTINATION TABLE NAME> SELECT * FROM <SOURCE TABLE NAME>

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

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.