Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6039879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:26:01+00:00 2026-05-23T06:26:01+00:00

I am building my first PHP/MySQL site and i would like to return search

  • 0

I am building my first PHP/MySQL site and i would like to return search results from two fields in my one table within the database – Catagory, and Location (There are 15 fields in total in the table, but there are only two required for the search).

Each option will have a drop down menu which will list a fixed number of choices in each field – for instance, there will probably be 15 or so Locations, and 7 or 8 Catagories.

I want the user to be able to select an item from either one or both drop down menus, click a ‘Search’ or @Go’ button, and be presented with the results.

As mentioned, i am brand new to PHP/MySQL so apologies if my question is a little ‘simple’ and i hope someone can point me in the right direction.

Thanks
Dan

EDIT:

Brad, Conner, I don’t have anything thus far i’m afriad in terms of the search query specifics, i’m just starting to research how to do it hence complete lack of code in my question!

But to try and be more specific, the only fields i want to return results from are Location and Job Catagory – these are two fields of about 15 in my table that are already populated with fixed terms – e.g, Location may have London, Manchester, Leeds, and Catagory may have Administrative, Management, Clerical etc – there is no option for the visitor to input a new term, only select from a drop down menu of pre-arranged items.

The other fields in my table aren’t relevant to the search (salary, company, contact email etc), so…I am thinking i only need two queries, and results can also be displayed if you only send one (e.g, you aren’t bothered about job location, just speciality, you could still find all the results and decide if you fancied relocating). Is that any better or more helpful?

Thanks for you help so far.
Dan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:26:02+00:00Added an answer on May 23, 2026 at 6:26 am

    A user enters a search query and you’d like to select the rows from your table that contain or exactly match that query? If so, something like

    For if category contains $search_query

    SELECT category, location 
    FROM table 
    WHERE concat(' ', category, ' ') LIKE '%$search_query%'
    

    Or if it is an exact match you would use this for your conditional instead:

    WHERE category = '$search_query'
    

    I’m probably offtrack though, you need to specify like Brad said

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building my first user control and I would like to package the
I'm currently building my first database in MySQL with an interface written in PHP
I'm building a PHP/MySQL app where users can log in and search for media
I'm building my first MVC3 website and have connected my site to a mdf
I'm building my first custom server control which inherits from CompositeControl The reason for
I'm about to begin work on my first ever PHP project -- building a
I am building out my first WordPress site for a client. I really want
I am building a PHP registration form which takes the following fields for up
I'm just building the like side of it first. Basically, I just want it
I'm building a MySQL movie posters/fan art database driven by a PHP script. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.