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 8975013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:46:54+00:00 2026-06-15T18:46:54+00:00

I would like to do a search engine for my webpage. I have several

  • 0

I would like to do a search engine for my webpage.
I have several tables in my mysql database and i would like them
combined when user

Table users
id  name        age country     vip profile_image
1   nick        23  sweden      1   yes
2   michael     20  germany     0   no
3   laura       19  usa         1   yes
4   gary        33  china       1   yes

Table online
id  user_id     online
1   1             1
2   2             1 
3   4             1

user_id is connected to id in users table

Now i have checkboxes
[ ] Those which are online
[ ] Those which are vip
[ ] Those with profile image

Im coding my page in PHP and im trying to figure how to include certain
searches in a sql query if certain checkbox is checked.
I can have tons of options here. Example if no checkbox is checked,
iff on you want to search for those which are online, how do i go in to the second table?

I hope you get my point here. I really hope someone could help me
and give me an working example of the php & sql query.

Cheerz!

  • 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-06-15T18:46:55+00:00Added an answer on June 15, 2026 at 6:46 pm

    First you have to check which checkboxes have been checked. Then you must write MySQL-query with PHP based on that information. You must think in every checkbox, what information it needs to check. If your database is well written, there is seldom a problem that two options affect each other. If information is in users-table, you need just write line to where-clause. If you need to join table to users-table to get information you need to do that too. Here is an example

    $query = "";
    $query .= "SELECT users.* FROM users";
    if ($include_online == 1) {
      $query .= " LEFT JOIN online ON online.user_id = users.id";
    }
    $query .= " WHERE";
    if ($include_vip == 1) {
     $query .= " users.vip = 1 AND";
    }
    if ($include_image == 1) {
      $query .= " users.profile_image = 'yes' AND";
    }
    if ($include_online == 1) {
      $query .= " online.online = 1 AND";
    }
    $query .= " users.name LIKE '%".$search_string."%'";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a database that we would like to index with Sphinx search engine.
I have cgi search engine for local flat database search and I would like
I have a search engine. I would like to select rows from my table
I would like to search tables in sql server for a table that has
I'm working on some search engine and I would like to have nice pagination,
I would like to build an internal search engine (I have a very large
i have a search engine for my page. as a result i would like
I would like to integrate in my web site a flights search engine. I
We have a small data set and would like to search through it in
I have an extensive menu in which I would like to search for and

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.