Gossamer Forum
Quote Reply
Not deleting?
I'm trying to delete links from the tables lsql_Links and lsql_Category for more than one ID. I currently have;

Code:
# get the list of ID's we need to delete...
my $sth = $DB->table('CatLinks')->select( GT::SQL::Condition->new('LinkID','<','50000') ) || die $GT::SQL::error;
while (my $hit = $sth->fetchrow_hashref) {
push (@id_list , $hit->{LinkID});
}

# remove old listings first...
$DB->table('Links')->delete( { ID => \@id_list } ) || die $GT::SQL::error;
$DB->table('CatLinks')->delete( { LinkID => \@id_list } ) || die $GT::SQL::error;

I know that the while {} loop is working fine, cos if I use join() to see what ID numbers exist in it, and all the ID's that should have been put in it are there.

It much be down to the delete() call, but I don't understand why Unsure

Any suggestions?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Not deleting? In reply to
Anyone got any suggestions? Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Not deleting? In reply to
At first glance I would guess that you want ID IN rather than ID => and if so you'll need a condition statement?
Quote Reply
Re: [afinlr] Not deleting? In reply to
I ended up using;

Code:
# get the list of ID's we need to delete...
my $sth = $DB->table('Links')->select( GT::SQL::Condition->new('ID','<','50000') ) || die $GT::SQL::error;
while (my $hit = $sth->fetchrow_hashref) {
push (@id_list , $hit->{ID});
}

print "Deleting IDs: \n\n";
print join("\n",@id_list) . "\n";

# remove old listings first...
foreach (@id_list) {
$DB->table('Links')->delete( { ID => $_ } ) || die $GT::SQL::error;
$DB->table('CatLinks')->delete( { LinkID => $_ } ) || die $GT::SQL::error;
}

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!