Jump to content


Photo

[solved]query help please cheers


  • Please log in to reply
1 reply to this topic

#1 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 27 August 2006 - 05:33 AM

advance thank you.

i want to select all in a table then insert it into another but how cheers.

example

<?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);
}
 }
?>




Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 27 August 2006 - 06:07 AM

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.


<?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); 

}
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users