Zend DB Table - WHERE as OR?

Zend DB Table - WHERE as OR?

am 09.04.2010 21:15:05 von Dan Joseph

--00163630f1cfeca2ba0483d29ce3
Content-Type: text/plain; charset=ISO-8859-1

Hi Everyone,

I'm trying to figure out if something is even an option with the Zend
Framework. We use the DB Table stuff. I don't see it in the manual, so I
figured I'd ask you all...

I have:

$select = $table->select()->where( "home_team_id = ?", $home_team_id )
->where( "away_team_id = ?", $away_team_id
);

This translates the where's to "home_team_id = 12 AND away_team_id = 15"...

What I'd like to have is "home_team_id = 12 OR away_team_id = 15".

Is this possible? Or would I just need to build them all into a single
where() manually?

--
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry

--00163630f1cfeca2ba0483d29ce3--

Re: Zend DB Table - WHERE as OR?

am 09.04.2010 21:25:18 von Andrew Ballard

On Fri, Apr 9, 2010 at 3:15 PM, Dan Joseph wrote:
> Hi Everyone,
>
> I'm trying to figure out if something is even an option with the Zend
> Framework.  We use the DB Table stuff.  I don't see it in the m=
anual, so I
> figured I'd ask you all...
>
> I have:
>
> $select =3D $table->select()->where( "home_team_id =3D ?", $home_team_id =
)
>                     =C2=
=A0            ->where( "away_team_id =3D ?",=
$away_team_id
> );
>
> This translates the where's to "home_team_id =3D 12 AND away_team_id =3D =
15"...
>
> What I'd like to have is "home_team_id =3D 12 OR away_team_id =3D 15".
>
> Is this possible?  Or would I just need to build them all into a sin=
gle
> where() manually?
>
> --
> -Dan Joseph
>


Try this:

$select =3D $table->select()->where( "home_team_id =3D ?", $home_team_id )
->orWhere( "away_team_id =3D ?", $away_tea=
m_id );



Andrew

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Zend DB Table - WHERE as OR?

am 09.04.2010 21:27:02 von Dan Joseph

--0016362848c2ad96210483d2c748
Content-Type: text/plain; charset=ISO-8859-1

On Fri, Apr 9, 2010 at 3:25 PM, Andrew Ballard wrote:

> Try this:
>
> > $select = $table->select()->where( "home_team_id = ?", $home_team_id )
> ->orWhere( "away_team_id = ?",
> $away_team_id );
>
>
Perfect...thank you!

--
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry

--0016362848c2ad96210483d2c748--