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

Products: Gossamer Links: Development, Plugins and Globals: Re: [Andy] Valid format for update() with CatLinks.CategoryID ?: Edit Log

Here is the list of edits for this post
Re: [Andy] Valid format for update() with CatLinks.CategoryID ?
You should use the delete/insert methods instead of do_query in order to handle any foreign keys.

Code:
$DB->table('CatLinks')->delete({ LinkID => $link->{ID} });
foreach (@CategoryIDs) {
$DB->table('CatLinks')->insert({ LinkID => $link->{ID}, CategoryID => $_ });
}

Last edited by:

Wychwood: May 12, 2008, 9:59 AM

Edit Log: