redarrow Posted August 27, 2006 Share Posted August 27, 2006 advance thank you.i want to select all in a table then insert it into another but how cheers.example[code]<?php$query="select * from shop_information where id='$id' ";$result=mysql_query($query);while($record=mysql_fetch_assoc($result)){foreach($record AS $data) {$query2="update copy_information set $data where id='$id' ";$result2=mysql_query($query2);} }?>[/code] Link to comment https://forums.phpfreaks.com/topic/18783-solvedquery-help-please-cheers/ Share on other sites More sharing options...
redarrow Posted August 27, 2006 Author Share Posted August 27, 2006 solved i worked it out this way select the database and then a while loop then insert to new table and then delete the old info from the 1st table.[code]<?php$query="select * from payment where id='$id'";$result=mysql_query($query);while($record=mysql_fetch_assoc($result)){$id=$record['id']; $name=$record['name']; $months_payed_for=$record['months_payed_for']; $added_date=$record['added_date']; $exspire_date=$record['exspire_date']; $added_time=$record['added_time']; $user_ip=$record['user_ip']; $price=$record['price']; $insert="insert into payment_info(id,name,months_payed_for,added_date,exspire_date,added_time,user_ip,price)VALUES('$id','$name','$months_payed_for','$added_date','$exspire_date','$added_time','$user_ip','$price')";$insert_result=mysql_query($insert);$delete="delete from payment where id='$id' ";$delete_query=mysql_query($delete); }?>[/code] Link to comment https://forums.phpfreaks.com/topic/18783-solvedquery-help-please-cheers/#findComment-81024 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.