Re: logic operands problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Merlin

Merlin Morgenstern wrote on 2009-12-07 11:52:
Hello everybody,

I am having trouble finding a logic for following problem:

Should be true if:
page = 1 OR page = 3, but it should also be true if page = 2 OR page = 3

The result should never contain 1 AND 2 in the same time.

This obviously does not work:
(page = 1 OR page = 3) OR (page = 2 OR page = 3)

This also does not work:
(page = 1 OR page = 3 AND page != 2) OR (page = 2 OR page = 3 AND page != 1)

Has somebody an idea how to solve this?

I've read the entire thread and can see that this is a MySQL query you want to make (I was about to tell you about the == comparison and the $ in a variable in PHP).

What you want is all results containing 1,2 or 3, so make a "WHERE page IN(1,2,3)" and use PHP logic to figure out if a free slot is available or not. Or rewrite your booking routine (use data and time fields instead, maybe by creating a bunch of free slots and then a booked field with a default of "0", changed to "1" when booked)

--
Kind regards
Kim Emax - masterminds.dk

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux