如何从现有Mysql数据库中获取记录,并将行数添加到新数据库中,等于所选记录

I have current mysql database and i want to make a query to this database with php and if any number of rows are selected based on this mysql query. I want to take variables from these selected rows and want to add this data to new mysql database i.e select rows from old database selected with WHERE clause and add these rows to new database. Is it possible in mysql with php. Thanks in advance.

Why not simply :

INSERT INTO NewDB.YourTable
SELECT * FROM OldDB.YourTable
WHERE ...