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
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!

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