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

Re: [Andy] Valid format for update() with CatLinks.CategoryID ?

Quote Reply
Re: [Andy] Valid format for update() with CatLinks.CategoryID ? In reply to
Hi,

For anyone interested, heres the solution code:

$link is the one hash of the link in question.. and @CategoryIDs is an array of the category ID's this link needs to be assigned to

Code:
$DB->table('CatLinks')->do_query(qq|DELETE FROM lsql_CatLinks WHERE LinkID = $link->{ID}|) || die $GT::SQL::error;

foreach (@CategoryIDs) {
$DB->table('CatLinks')->do_query(qq|INSERT INTO lsql_CatLinks (LinkID,CategoryID) VALUES ($link->{ID},$_)|) || die $GT::SQL::error;
}

Just in case anyone comes across a similar problem :)

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!
Subject Author Views Date
Thread Valid format for update() with CatLinks.CategoryID ? Andy 3135 May 11, 2008, 4:18 AM
Thread Re: [Andy] Valid format for update() with CatLinks.CategoryID ?
Wychwood 3038 May 11, 2008, 5:16 PM
Thread Re: [Wychwood] Valid format for update() with CatLinks.CategoryID ?
Andy 3032 May 11, 2008, 11:52 PM
Thread Re: [Andy] Valid format for update() with CatLinks.CategoryID ?
Andy 3039 May 12, 2008, 2:27 AM
Thread Re: [Andy] Valid format for update() with CatLinks.CategoryID ?
Wychwood 3028 May 12, 2008, 9:57 AM
Post Re: [Wychwood] Valid format for update() with CatLinks.CategoryID ?
Andy 3027 May 12, 2008, 10:01 AM
Thread Re: [Andy] Valid format for update() with CatLinks.CategoryID ?
brewt 3011 May 12, 2008, 1:32 PM
Post Re: [brewt] Valid format for update() with CatLinks.CategoryID ?
Andy 3001 May 12, 2008, 2:02 PM