DB Read - How to define the WHERE condition for not equal to 0 AND not equal to space

wallyhowe 10 Dec, 2019

I have a table that I am trying to select on a field that is a name field 'highBidder' for highest bidder in an auction.

If a bid has not been made the field is either 0 or a space.

So I need to select all records where there is a name and am doing this by not selecting those where the field is a 0 or space.

I can de-select all records where there is a 0 entry by using:

return array ('highBidder !=' => '0' );

Trying to add the additional test of not being a space either is where I am stuck.
I have looked at the FAQ on building a WHERE statement in chronoforms5
and have tried all ways I can think of to add the additional test of not
being a space but without success.

Please put me out of my misery.

Thank you

Wallyhowe
healyhatman 11 Dec, 2019
If there's no bidder, you should make it NULL or an empty string, not 0 / space.
And if it's an array, does array('highBidder !=' => '0', 'highBidder !=' => ' ') work?
wallyhowe 11 Dec, 2019
Thanks for your response healyhatman

In CF4 the statement was:
item.highBidder <>"0" AND item.highBidder <>" "
and that works fine in CF4.

The line you gave me was one I had tried expecting it to work. Just tried it again in case I had got it wrong but it delivers the full file (valid name, 0 and space) without a mysql error so the code check is valid SQL but failing to work .

Also tried

return array ('item.highBidder !=' => '0', 'item.highBidder !=' => ' ');

That returns all results as well.

The file I am checking is produced by third party auction software so I am not in control of what the null value is.

It has to be the space/null that is the issue since conbining checks does work:


return array ('highBidder !=' => '0' , 'currentBid !=' => '0' );

gives the answer I am looking for in a round about way.

Puzzling!!

Wallyhowe
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger