Evert wrote:
> Hi all!
> What is the best/easiest way to use PHP to move a selection of MySQL
> records from one table to another table, which is in the same database
> and which has the same structure as the first table?

here's a stab at it (not tested):

    'select * from from_table
    where id="'.join('" or id="',$ids_to_get).'"'
    foreach($r as $k=>$v)$fields[]='`'.$k.'`="'.addslashes($v);
    echo('insert into to_table set '.join(',',$fields).'<br />');
#    mysql_query('insert into to_table set '.join(',',$fields));

obviously, first try the above to make sure the SQL looks right, before you uncomment the line that does the damage


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to