Jump to content

Dreamweaver where search


bigleo23

Recommended Posts

I have a mysql table being searched by two fields city and state

using dreamweaver, I have set up a form with a text field as city and a menu as state field.

The problem is on the results page, I have a recordset SELECT * FROM table name. What do I do with the WHERE, I have tried multiple configurations, and I can't get anything to work. I only want to search by two fields, city and state. The state has to match, but if the city is left blank, I still want to filter by state.

 

Can somebody help me or point me in the right direction, please?

Link to comment
Share on other sites

I am sorry fenway, but I am not understanding. I have two search parameters city and state I want it to search two fields in the table the city and state fields.

 

I'm not tring to be rude, as I am not used to building two field WHERE clauses

Link to comment
Share on other sites

That is exactly what I want, so what do I do, I don't join the fields do I because I only want the city field searched when a city is entered?

You have 2 conditions:

 

#1: WHERE state = '$state'

 

#2: WHERE state = '$state' AND city = '$city'

 

SQL can't decide when do #1 vs #2 -- you need php application code to do this.  I don't know what part of this is "difficult".

Link to comment
Share on other sites

OK, I think the problem in communication we ae haveing is, I thought dreamweaver automaticly inserted the php code when the recordset was created. The problem I am having is creating the where in the recordset so that dreamweaver could create this code.

 

If it would help at all, I have no problem with you looking at the source code

 

Link to comment
Share on other sites

So basically what you are saying fenway is that you absolutely have wasted my time. In the subject and a few of my posts I let it be known that I am working with dreamweaver and that is basically what my question revolves around. You have no idea about what dreamweaver does and you only want to give me one line answers that absolutely do not help, so why did you even start replying to my post in the first place.

Link to comment
Share on other sites

No, your question revolves around a database query... but therein lies your actual problem.  If you don't know how to use the tool you've chosen for the job to implement the solution, then you've wasted my time, not vice versa.  But hey, by all means, wait for someone else's help -- you will receive no more from me.

Link to comment
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.