Gossamer Forum
Quote Reply
GT::SQL::Condition
Hi guys/gals. I've got a bit stuck on this bit of code. Basically, I just want to grab the name/id of the query in question.

Code:
my $Name = "Global/%" . $hit->{State_RegionName};
my $Full_Name = $category_table->select( 'Full_Name', GT::SQL::Condition->new('Full_Name','LIKE',$Name) )->fetchrow || die $GT::SQL::error;
my $ID = $category_table->select( 'ID', GT::SQL::Condition->new('Full_Name','LIKE',$Name) )->fetchrow || die $GT::SQL::error;

I keep getting this error message though;

Quote:
Died at db_update.cgi line 84.

Anyone got any ideas?

TIA.

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] GT::SQL::Condition In reply to
Hi,

I'm not sure but I think the first parameter should be the condition to query and the second is the field name and they are array ref such as ['ID'] or ['Name']

Cheers,

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] GT::SQL::Condition In reply to
It normally works with;

$DB->table('Category')->select( 'FieldName', { Field => Value } )->fetchrow;

Unsure

I managed to get around it by just grabbing the whole result, and then using a while {} to go through it, and grab the data I needed.

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] GT::SQL::Condition In reply to
my ($Full_Name,$ID) = $category_table->select( ['Full_Name','ID'],GT::SQL::Condition->new('Full_Name','LIKE',$Name) )->fetchrow_array;