Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

how to delete links between id 2000 and id 3000

Quote Reply
how to delete links between id 2000 and id 3000
I wan to mass delete links between id 2000 and id 3000

Thanks
Quote Reply
Re: [rage] how to delete links between id 2000 and id 3000 In reply to
Use phpmyadmin ....
Blacknight Solutions - Hosting
Search.ie
Armchair.ie
Quote Reply
Re: [rage] how to delete links between id 2000 and id 3000 In reply to
Hi,

First of all BACKUP VIUA MySQLMan! I won't be held responsible if this doesn't do what you want Tongue

Run (obviously replacing glinks_ with whatever you have):

DELETE FROM glinks_Links WHERE ID > 2000 AND ID < 3000

..and then:

DELETE FROM glinks_CatLinks WHERE LinkID > 2000 AND LinkID < 3000

...Then, you need to run Build > Repair Tables , to fix your category counts.

Hope that helps.

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] how to delete links between id 2000 and id 3000 In reply to
Note that deleting links via SQL queries like this will result in records being left behind (you'll have entries left in the Bookmarks, and other tables that reference the Links table). Although not easy to do for most people, the best way is to write a short bit of code to do it, or use the admin interface (which probably won't work too tell for this number of links). Here's some (untested, though it should be fine) sample code:
Code:
#!/usr/bin/perl -w

use strict;
use lib '/path/to/admin';
use Links qw/:objects/;

Links::init('/path/to/admin');

$DB->table('Links')->delete(GT::SQL::Condition->new(ID => '>' => 2000, ID => '<' => 3000));

Adrian
Quote Reply
Re: [brewt] how to delete links between id 2000 and id 3000 In reply to
Good point - didn't think of that <G>

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: [brewt] how to delete links between id 2000 and id 3000 In reply to
Where I should place this code?
Quote Reply
Re: [rage] how to delete links between id 2000 and id 3000 In reply to
You would put it in a file and run 'perl /path/to/file' in shell.

Adrian

Last edited by:

brewt: Jul 13, 2007, 2:48 PM