Jump to content

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
https://forums.phpfreaks.com/topic/98445-dreamweaver-where-search/
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".

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

 

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.

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.

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.