matewe Posted November 17, 2006 Share Posted November 17, 2006 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.. Quote Link to comment Share on other sites More sharing options...
btherl Posted November 17, 2006 Share Posted November 17, 2006 Do you have prior experience with forms, php and mysql? That will help us know what kind of answer you need. Quote Link to comment Share on other sites More sharing options...
matewe Posted November 17, 2006 Author Share Posted November 17, 2006 I have the basic understanding of querying with a single form and returning the results. I am not sure how to do it with more than 1 form field. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted November 17, 2006 Share Posted November 17, 2006 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. Quote Link to comment Share on other sites More sharing options...
matewe Posted November 17, 2006 Author Share Posted November 17, 2006 Thanks that does clarify the approach will use tutorials to get in depth on other aspects within this area. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.