Jump to content

Recommended Posts

Hi folks

I have a database to store simple entries on goods coming in which contains 4 columns such as:

goods date department signedoff

If I have entries in the database that don't contain a department and I do a query to select a keyword but leave my search form blank for department, it also returns all the blank entries under department.

For example, I have entries in the DB containing this:

Goods | Date | Dept | Signedoff
---------------------------------------------------
Laptop | 060525 | IT | Jeff
P4 Comp | 060522 | Admin | Jeff
P3 COmp | 060522 | | James
Lappy | 060426 | | Blake
Ipod | 060411 | Admin | Blake


And I do a query for example:

select * from mydb where Goods like 'Lappy' or Date like '' or Dept like '' or Signedoff like ''

It will return the following rows:

P3 Comp | 060522 | | James
Lappy | 060426 | | Blake


Any idea how I could make it strip out the empty rows?

Thanks very much for any help.

Regards,
Dave
Link to comment
https://forums.phpfreaks.com/topic/10408-query-returning-empty-rows/
Share on other sites

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.