I am having one issue with reading an SQLite 3 database via PHP's PDO class and I have one question about queries in general.
The issue I am having is with my query string not returning anything if any of the fields I am checking are empty even though others are not empty. Here is the query string I am using:
SELECT * FROM ZENTRY WHERE ZPLATFORM = "' . $platform . '" AND ZCUSTOM2 != "wishlistitem" ORDER BY ZTITLE ASC
Some of the ZCUSTOM2 fields contain the data "wishlistitem" and the rest contain no data at all. Is there anything I can do besides inserting data into the empty fields (which does work but is not the best solution in this case) to fix this?
Now my question is simply is it possible to write a query with a wildcard for the field in the WHERE part of the query? Example:
SELECT * FROM ZENTRY WHERE ZPLATFORM = "' . $platform . '" AND * != "wishlistitem" ORDER BY ZTITLE ASC
Basically I would like to set it up so that if any field contains the string "wishlistitem" it returns false so that if I ever decided to share this it will be easier for others to setup their databases (this is a read-only web front-end for a desktop application that stores its data in SQLite 3 format) without needing to edit much (or better yet anything) in the PHP files since other users may be using a field other than ZCUSTOM2 for this data.