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
https://forums.phpfreaks.com/topic/27535-multiple-form-queries/
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
https://forums.phpfreaks.com/topic/27535-multiple-form-queries/#findComment-125957
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.