Re: Zend DB Table - WHERE as OR?

From: Date: Fri, 09 Apr 2010 19:25:18 +0000
Subject: Re: Zend DB Table - WHERE as OR?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-303951@lists.php.net to get a copy of this message
On Fri, Apr 9, 2010 at 3:15 PM, Dan Joseph <dmjoseph@gmail.com> 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 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 > Try this: <?php $select = $table->select()->where( "home_team_id = ?", $home_team_id ) ->orWhere( "away_team_id = ?", $away_team_id ); Andrew

« previous php.general (#303951) next »