0

Could someone please tell me the correct syntax for a Zend DB query to represent the last line (the and (xxx or xxx)

...
where
    id = 1241487470
and (contract=0 or is_work IS NOT NULL)
...

I'm stuck at this:

->where('id = ?', 1241487470)
->where(...)

2 Answers 2

3

This seemed logical and worked. So Yay.

->where('id = ?', 1241487470)
->where('contract= ? or is_work IS NOT NULL)
Sign up to request clarification or add additional context in comments.

2 Comments

This is the correct way of handling this situation. However did you mean Zend DB rather than Form?
Yes I did :) must have been a long day. I've corrected it. Cheers.
2

This seems works too and preserve zend db escapement

->where('id = ?', 1241487470);
->where('(contract = ?', 0);
->orWhere('is_work IS NOT NULL)');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.