[FX.php List] Confusion with 'not equals' search
Roger Price
rp272 at cam.ac.uk
Tue May 8 10:31:26 MDT 2007
I have a simple database with a 'classification' field which contains the the values:
event
lectures
seminar
news
vacancy
I want to list all records that are neither news nor vacancy so I add the request lines
$Query->AddDBParam('classification', 'news', 'neq');
$Query->AddDBParam('classification', 'vacancy', 'neq');
The default logical operator is 'and' so I would expect a find to return just 'events', 'lectures' & 'seminars' because these are not equal to news and not equal to vacancy, but I get all records returned.
If I add:$Query->AddDBParam('-lop','or');
I just get a couple of 'vacancies' when I would have expected the full dataset including 'vacancy' and 'news because 'news' should be selected because they are not vacancies, and vacancy because it is not 'news'. Everything else should be included because it is neither!
I am obviously missing something important and I know that multiple negatives can be confusing. When I only use one 'neq' it behaves as I expect. Is this a limitation of FX.php?
I realise that there are other ways to achieve what I need but I would like to undersatand how 'neq' works!
kindest regards
Roger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20070508/54476c81/attachment.html
More information about the FX.php_List
mailing list