Reputation: 109
I have created a blog and articles on my website and tried to compare present topic from the records/topics in the database.
Just like what I see on most websites, I want to display RELATED or SIMILAR topics from the database and display it on my website.
//On my query, I used :
$topic = "How to know your strengths";
$sql = "SELECT * FROM articlestbl WHERE articles like '%s$topic%'";
Now, I want to display more topics related to this, but it only displays topics which starts and ends with $str.
Does anybody knows?
Upvotes: 1
Views: 543
Reputation: 602
Are you looking for something like this:
$sql = "SELECT * FROM articlestbl WHERE articles like '%".$topic."%'";
Upvotes: 1