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

GT::SQL::Condition not structured correctly?

Quote Reply
GT::SQL::Condition not structured correctly?
Hi guys. I'm having a bit of a problem with a "count" I'm doing.

Code:
my $cond = GT::SQL::Condition->new('Message.msg_username','=',$USER->{user_username} =>, 'PMFoldersIDs.folder_id' => '=' => $folder_id);
$cond->bool('AND');

I've also tried it without bool()...

Basically, I need it to only;

Message.msg_username MUST EQUAL $USER->{user_username}
PMFoldersIDs.folder_id MUST EQUAL $folder_id (a number)

Can anyone give me a hand with this? I've tried the new structuring of;

'Field' => '=' => $value, 'Otherfield' => '=' => $value2

.. but that gives an incorrect count.

It seems to only be taking into account the "Message" table count, as its giving back 239, instead of 2 (which is what it should be).

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 not structured correctly? In reply to
Hi Andy,

Is this a typing error?:

my $cond = GT::SQL::Condition->new('Message.msg_username','=',$USER->{user_username} =>, 'PMFoldersIDs.folder_id' => '=' => $folder_id);

Edit: Also, I don't think you should need a Condition for this - can't you just put it in the count/select statement?

Last edited by:

afinlr: Jul 6, 2004, 12:36 PM
Quote Reply
Re: [afinlr] GT::SQL::Condition not structured correctly? In reply to
Quote:
Is this a typing error?:

Yeah.. it shouldn't have been like that :/ Must have typed it a bit wrong when I posted it here.

Quote:
Edit: Also, I don't think you should need a Condition for this - can't you just put it in the count/select statement?

Tried this already... but it was giving me the 190+ count, instead of 2 (which it should).

Thanks for your help on this...

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 not structured correctly? In reply to
Can you turn debugging on and see what the actual count statement that mysql is using looks like? Are your tables joined properly?
Quote Reply
Re: [afinlr] GT::SQL::Condition not structured correctly? In reply to
Quote:
Are your tables joined properly?

That was the problem... seems to be working now :)

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!