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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:48:22+00:00 2026-05-28T16:48:22+00:00

I want to select a post only if $arr_tags match all array_elements with tags_is_tags

  • 0

I want to select a post only if $arr_tags match all array_elements with tags_is_tags. For example in this situation will be outputted 0 posts because one array element didn’t match with tags_id_tags

How can i do something like that ?

$arr_tags = array("16", "17", "36", "543"); // the dimension is not always the same

post_id_post        tags_id_tags    
    282                      16     
    282                      17     
    282                      36 
    282                      546 

I have this code but the query is not finished.

            $sql = $db -> prepare("
                SELECT post_id_post 
                FROM posts
                // ...
            ");

            $sql -> bind_param('s', $val);
            $sql -> execute();
            $sql -> bind_result($d_post);

Thanks for your time

  • 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-28T16:48:23+00:00Added an answer on May 28, 2026 at 4:48 pm
      SELECT post_id_post
        FROM posts
       WHERE tags_id_tags IN ("16", "17", "36", "543")
    GROUP BY post_id_post
      HAVING COUNT(*) = 4
    

    You put all the required tags’ IDs in the IN clause and change the number in COUNT(*) = 4 expression to the number of tags passed

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

Sidebar

Related Questions

A post have many comments, I want to select only posts wich have comments
Here's what I want to accomplish: Select all rows from table posts while also
I want to select all posts that contain a specific tag. I'm trying it
i have users table and i have posts table i want select from users
For Example, I want to know the User have how many post. So, I
I have 2 tables, Forums and Posts. I want to retrieve all Forums fields
For example: $lang['Select Project'] = 'Select Project OK'; $lang['Project'] = 'Project'; I want to
i want to select the following strings from this html using just lxml and
I want to show only the top 5 comments for a specific post (Like
I want to select a row (that appears multiple times) from a table ONLY

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.