Level 73
I would use a many to many for that instead that way the logic would be way easier.
However with your code you can explode the string into an array and then loop over the resulting array looking for matches in your table.
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I've posts that have column tags and stored like that (tag1, tag2, tag3)
I want in the single post page to show the related topics depends on the post tags.
How can I do this...
Forexample: I want 10 posts that have at least one of these single post tags.
I would use a many to many for that instead that way the logic would be way easier.
However with your code you can explode the string into an array and then loop over the resulting array looking for matches in your table.
Please or to participate in this conversation.