Jump to content

Recommended Posts

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.