I have 3 fields in database:
levelOne , levelTwo, levelThree // Table Name = levels
With values:
levelOne = 300,
levelTwo = , // This field is empty
levelThree = , // This field is empty
Now I have a variable which have to be compared with the respective fields.
$var = 200;
This $var should only be compared with levelOne, not levelTwo and levelThree. And so on for all
What should the query look like?
Possible cases of fields in database:
Case 1:
levelOne = 300,
levelTwo = , // This field is empty
levelThree = , // This field is empty
Case 2:
levelOne = 500,
levelTwo = 700,
levelThree = , // This field is empty
Case 3:
levelOne = 500,
levelTwo = 700,
levelThree = 100,
Now $var should be compared with the last most non-empty level
Example:
In case 1 $var
should be compared with levelOne.
In case 2 $var
should be compared with levelTwo.
In case 3 $var
should be compared with levelThree.
Basically I have 3 levels of categories.
User will post a listing with any level of categories.
Now a buyer will post presets of any category he wants to bid on.
Now if he provided levelOne category in his preset, it will match with all the listings having levelOne category.
Now if he provided levelTwo category in his preset, it will match with all the listings having levelTwo category.
Now if he provided levelThree category in his preset, it will match with all the listings having levelThree category.
So thats how these bids will automatically post on the related listings.
Thats my goal.