Gossamer Forum
Quote Reply
MYSQL IN()
I am shure we had this before, but i cant search for IN. :)

I have a field with numbers seperated by ","
And i want a global that takes data for this ids.

Found it:

Code:

my @values = split(',', $postids);
...
GT::SQL::Condition->new (post_id => IN => \@values)

Last edited by:

Robert: Dec 18, 2016, 9:57 AM
Quote Reply
Re: [Robert] MYSQL IN() In reply to
Hi Robert,

I guess
Code:
ID => 'IN' => \"($postids)")
or
Code:
ID => 'IN' => \"(\@values)")
should work

Regards

Niko

Ah, sorry, probably your code works, misread your post.

Last edited by:

el noe: Dec 19, 2016, 2:45 AM
Quote Reply
Re: [el noe] MYSQL IN() In reply to
Yes, i made it with

ID => 'IN' => \"(\@values)")

as a solution from you some month before i guess :)
Quote Reply
Re: [Robert] MYSQL IN() In reply to
Code:
ID => 'IN' => \"(\@values)")

Should be:

Code:
ID => 'IN' => \@values

..or how I personally do it (I don't like the x => y => z format ;))

Code:
GT::SQL::Condition->new('ID','IN',\@values)

\@ turns it into an arrayref, so GLinks knows how to deal with it.

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