Gossamer Forum
Home : Products : Gossamer Links : Discussions :

add link to data

Quote Reply
add link to data
I use this code to insert new ID to the links table
sub {
my $today = GT::Date::date_get();
$DB->table('Links')->insert(
Add_Date => \"$today",
Title => "test test",
Mod_Date => \"$today",
LinkOwner => "admin",
URL => "http://www.site.com" ) or return $GT::SQL::error;
return;
}

Who can I insert the category of this link in the CatLinks, I can use a default category?

Last edited by:

Andy: Nov 4, 2009, 8:01 AM
Quote Reply
Re: [nir] add link to data In reply to
Try:

$DB->table('CatLinks','Links')->insert(
'CatLinks.CategoryID' => 1234,
Add_Date => $today,
Title => "test test",
Mod_Date => $today,
LinkOwner => "admin",
URL => "http://www.site.com" ) or return $GT::SQL::error;
return;
}

BTW, no need for:

\"$today"

..just use:

$today

Wink

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates

Last edited by:

Andy: Nov 4, 2009, 8:01 AM
Quote Reply
Re: [Andy] add link to data In reply to
I try to use this globule to modify some of the columns of specific ID but it not working… (I think is not the right way:))


sub {

my $id = $_[0];
my $newHits = $_[1];

$DB->table('Links')->update( { Hits => $ newHits } , { ID => $ id } ) or die $GT::SQL::error;

return;
}
Quote Reply
Re: [nir] add link to data In reply to
It work:)
$DB->table('Links')->update( { Hits => $ newHits } , { ID => $ id } ) or die $GT::SQL::error;
Smile