Skip to main content
February 21, 2010
Question

Easy MySQL data filtering question

  • February 21, 2010
  • 1 reply
  • 297 views

I've got a pretty dumb question.

When creating a search query (in DW CS4), how do I specify that if a field is submitted blank, the DB should return all results?

As in, maybe I want to find all people who live in a certain city - I would choose the city in the search form, but I would leave "name" blank, because I don't want to limit by name. So how do I tell it to not try to match blank fields and instead return all?

Thanks in advance.

+mf

This topic has been closed for replies.

1 reply

February 21, 2010

Anyone? Anything?  I figured this would be an easy one.

I've got the following form fields to search the corresponding columns:

  • Company (can be = as form field is dynamically generated with available values)
  • Contact Name (same as above)
  • Phone (varchar) using LIKE
  • Payment Status (int) 1,0
  • Sponsor (varchar) can use = as all data was entered using pre-populated drop-down menus.
  • Amount Paid (varchar) uses drop-down consisting of ranges (0-99, 100-499, 500-999, 1000-4999, 5000-9999, 10000+)
  • Golfer's Name: This is a text field that needs to search 4 different db columns (golfer_1, golfer_2, golfer_3, golfer_4)

So that's what I'm working with and I could REALLY use some help... I've never quite gotten the hang of this.

David_Powers
Inspiring
February 21, 2010

It's not quite as simple as you would like to think. However, the following article in the Dreamweaver Cookbook might help: http://cookbooks.adobe.com/post_Create_search_query_with_optional_fields-16245.html.