Gossamer Forum
Home : General : Databases and SQL :

Add OR to WHERE clause

Quote Reply
Add OR to WHERE clause
Could someone please tell me the correct format for adding an OR clause to the WHERE part of the following query.

my $sth = $table->select (['fieldname'],{'fieldname' => $home->{cgi}->{fieldname}???? } );


I thought it should be something like the following but it doesn't work.

my $sth = $table->select (['fieldname'],{'fieldname' => $home->{cgi}->{fieldname}, 'OR', 'fieldname2' => $home->{cgi}->{fieldname2} } );


What should it be?

Thank you.

Simon.
Quote Reply
Re: [jai] Add OR to WHERE clause In reply to
It may be best posting in the dbman sql forum as the code is specific to GT::SQL.

You need to use a condition object.

If you click "Help" in your admin panel and look for the Condition documentation it should tell you what you need to know.
Quote Reply
Re: [Paul] Add OR to WHERE clause In reply to
Thanks Paul.

I'll repost in the DBman SQL forum because I'm still not sure how to change what I have into a Condition object.

Simon.