- Published On: 10/01/08
- Last Edited: 10/01/08
- Topic: Web
- Author: Tom Bates
Using OR rather than AND with GetList in POG
The POG (Php Object Generator) GetList method supports the setting of multiple conditions out of the box. Heres how to use OR for your conditions, instead of AND.
This is going to be a quick one – something I ran into whilst making this website. There’s mention of it in the POG google group, though not a lot, and only brief explanations for those new to PHP to work with! So here it is.
The following code gets all pets whose breed is ‘dog’, and whose age is under 5:
$petList = $pet->GetList(array(array("breed", "=", "dog"), array("age", ">", 3)));
What if you wanted all pets whose breed is ‘dog’, OR any pet whose age is under 5? You would write this instead:
$petList = array_merge($pet->GetList(array(array("breed", "=", "dog"))), ($pet->GetList(array(array("age", ">", 3)))) ;
And there we have it – the trick is ‘array_merge’. I’m hoping this may have saved you a little time!
Topic Filter:
(Reset filter)
Using OR rather than AND with GetList in POG
10/01/08The POG (Php Object Generator) GetList method supports the setting of multiple conditions out of the box. Heres how to use OR for your conditions, instead of AND.
Stopping nosebleeds: how to stop a nosebleed - mild, moderate and severe.
13/01/08A concise and practical guide to nosebleeds, brought together from ambulance crews and hospital doctors!
Dolphins saving people: dolphins and altruism
18/02/08Are dolphins moral agents? Exploring altruism, and reports of dolphins saving humans
Dolphins and Drive Hunting In Japan
21/02/08Learn the harrowing reality of Drive Hunting Dolphins in Japan and elsewhere
A review of Love and Death on Long Island - Gilbert Adair
03/03/08A review and essay for this exceptional novella
Password required for localhost in firefox
02/04/08When hitting your http://localhost with firefox, it'll ask for a password. Here's the fix...
Making a DIV fill the viewport vertically with CSS
11/04/08How to get a DIV to stretch to fill the window using CSS?
Shortcut for tabbing between windows in Open Office in OS X
04/08/08The keyboard shortcut to cycle through open documents in Open Office on OSX
Dawkins unfashionable already
07/08/08On the irritation of some UK newspapers, and my irritation with them.
The OMM Jirishanca 35RL MSC: Review and Test
19/08/08A test and review of the OMM Jirishanca 35RL MSC, including photos


I was looking for this, thanks!
Posted: 17/03/08