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
You put all the required tags’ IDs in the
INclause and change the number inCOUNT(*) = 4expression to the number of tags passed