Gossamer Forum
Home : Products : Gossamer Links : Discussions :

slect lines and add to another table?

Quote Reply
slect lines and add to another table?
I have slected lines from Links, haw to get all fields from slected lines and add the lines to another table?
Quote Reply
Re: [Troja] slect lines and add to another table? In reply to
Aloha,

Ehm maybe u can refine your question ?



Me quess now is: add columns one be one mannuly in the new table ...

Open 2 windows (1 with links table and 1 with the new table u created) and look carefully at the value's of each field... Like enum,char type...

But again refine your question and maybe someone has a better solution.

Good luck, with it...
Quote Reply
Re: [startpoint] slect lines and add to another table? In reply to
Thanks for the answer but I do't what to make this action mannulay.
Quote Reply
Re: [Troja] slect lines and add to another table? In reply to
I think this must be the right way but the records don't add to Links2

my $db = $DB->table('Links');
my $db2 = $DB->table('Links2');

my $hits = $db->query ( { Field_A => 'x', Field_B => 'y' } );

if ($db->hits) {
foreach my $hit (@{$hits})
{
$hash = $db->array_to_hash($hit);
$db2->add ( Title => $hit->{Title});
}
}



Any ideias?
Quote Reply
Re: [Troja] slect lines and add to another table? In reply to
Try:

my $link_db = $DB->table('Links');
my $other_db = $DB->table('Links2');

my $sth = $db->query_sth ( { Field_A => 'x', Field_B => 'y' });
while (my $hash = $sth->fetchrow_hashref) {
$other_db->add ($hash) or die "Can't add: $GT::SQL::error";
}

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] slect lines and add to another table? In reply to
Thank you Alex