Forum Moderators: coopster

Message Too Old, No Replies

Moving fields from one table to another

Moving fields from one table to another

         

vic_msn

5:35 am on Nov 7, 2006 (gmt 0)

10+ Year Member



Suppose there are two tables namely "table1" and "table2" in my database
These fields are present in both tables
name
age
city
I have 11 rows[names,age and id of 11 persons] in table2 and want to transfer any row[name,age and id of any one person] to table1
how can i do this using php.

mcibor

10:53 pm on Nov 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



With MySQL

[dev.mysql.com...]

INSERT INTO table2 (name, age, id) SELECT table1.name, table1.age, table1.id FROM table1 WHERE id < 11;

Or with php:
1. Read table1,
2. validate data,
3. write to table2.

Hope this helps
Michal

And welcome to Webmasterworld!