|
askum..
honey nk mtk tolong..
cmne nk copy data dr row yg sblmnye tuk row baru dlm table ..
tuk setiap table dlm database tuh..
gune mysql..
honey wat system gune php.. |
|
|
|
|
|
|
|
maksudnya ni nak copy ke new table ke dalam satu database? |
|
|
|
|
|
|
|
selalu aku buat mcm n je...........sapa ada cara lain leh kongsi
$sql1="select data from table";
$result1=mysql_query($sql1);
while($row1=mysql_fetch_assoc($result1)) {
$sql2="insert into newtable newdata=$row1";
$result2=mysql_query($sql2);
} |
|
|
|
|
|
|
|
kalau dua table tuh identical... kira sama field atau susunan field... boleh pakai gini kot sql statement dia..
INSERT INTO <first_table_name> Values(SELECT * FROM <second_table_name>)
nih sql statement dia je... ikut suka hati nak guna dalam language apa... |
|
|
|
|
|
|
|
Biasanya kalau table to table sql state lebih kurang mcm ni
insert into table1 select * from table2
kalau guna variable barulah
insert into table1 values('1', '2') |
|
|
|
|
|
|
| |
|