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

Weird bug in globals :/ Double limit.

Quote Reply
Weird bug in globals :/ Double limit.
Hi,

Can anyone see any reason why this code would add;


LIMIT 1 LIMIT 1

..at the end of the MySQL query?

Code:
sub {

my $catids = $DB->table('Category')->children(2); # business
my $catids2 = $DB->table('Category')->children(1); # perwonal

my $tbl = $DB->table('CatLinks','Links');
$tbl->select_options("LIMIT 1");

my $hit = $tbl->select( ['Links.Photo','Links.ID'] , GT::SQL::Condition->new ('CatLinks.CategoryID', 'IN', $catids, 'isValidated', '=', 'Yes', 'LinkOwner','=',$USER->{Username},'Photo','LIKE','%' ) )->fetchrow_hashref;

if ($hit->{Photo}) { return { photo_id => $hit->{ID} } }

my $tbl2 = $DB->table('CatLinks','Links');
$tbl2->select_options("LIMIT 1");

my $hit = $tbl2->select( ['Links.Photo','Links.ID'] , GT::SQL::Condition->new ('CatLinks.CategoryID', 'IN', $catids2, 'isValidated', '=', 'Yes', 'LinkOwner','=',$USER->{Username},'Photo','LIKE','%' ) )->fetchrow_hashref;

if ($hit->{Photo}) { return { photo_id => $hit->{ID} } }
}

I keep getting an error:

cute query: 'SELECT up_Links.Photo,up_Links.ID FROM up_CatLinks,up_Links WHERE up_CatLinks.LinkID = up_Links.ID AND (up_CatLinks.CategoryID IN (30195,30205,30200,30187,30191,30193,30197,30203,30202,30190,30185,30198,30181,30199,30194,30184,30192,30204,30201,30186,30196,30182,30183,30189,30206,30188) AND up_Links.isValidated = 'Yes' AND up_Links.LinkOwner = 'robg' AND up_Links.Photo LIKE '%' LIMIT 1 LIMIT 1

I'm confused as hell as to where this extra LIMIT 1 is coming from :/

TIA

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