Reputation: 15037
How do you search for a term in multiple columns: title
,content
. For example:
$searchTerm = 'android';
SELECT * FROM posts WHERE `title` OR `content` contains $SearchTerm
Upvotes: 0
Views: 183
Reputation: 659
SELECT
*
FROM
posts
WHERE
lower(`title`) LIKE '%android%'
OR lower(`content`) LIKE '%android%'
Upvotes: 1
Reputation: 11588
$sql = "SELECT * FROM posts WHERE `title` LIKE '%$SearchTerm%' OR `content` LIKE '%$SearchTerm%'";
Upvotes: 0
Reputation: 91983
SELECT *
FROM posts
WHERE
`title` LIKE '%android%'
OR `content` LIKE '%android%'
Upvotes: 0