Jump to content

Multiple form queries


matewe

Recommended Posts

I am designing a business directory and i am looking for a way to query the mySQL database with 2 form values that a user enters. A user would normally use 1 or 2 form fields to search for a listing i.e a business name or a business category and location name e.g plumber in new york..or a ABC Taxis in Los angeles..company name and location..
Link to comment
Share on other sites

The basic MySQL syntax for what you want is:
SELECT * FROM [i]table[/i] WHERE [i]condition_1[/i] AND [i]condition_2[/i]

[i]condition[/i] can be things like:
[i]table_column[/i] > 5
[i]table_column[/i] = 'howareyou'
etc.

So...
SELECT * FROM table WHERE business_name LIKE '[i]name_from_form[/i]' AND business_type = [i]type_from_form[/i]

You should start by finding a tutorial on writing an HTML form and just echoing out what was submitted.  After you can do that you'll want to move on to using what was submitted to pull data from a database.
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.