I'm trying to delete links from the tables lsql_Links and lsql_Category for more than one ID. I currently have;
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
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!
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
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!