如何在多列中搜索一个词:title
, content
. 例如:
$searchTerm = 'android';
SELECT * FROM posts WHERE `title` OR `content` contains $SearchTerm
SELECT
*
FROM
posts
WHERE
lower(`title`) LIKE '%android%'
OR lower(`content`) LIKE '%android%'
SELECT *
FROM posts
WHERE
`title` LIKE '%android%'
OR `content` LIKE '%android%'
$sql = "SELECT * FROM posts WHERE `title` LIKE '%$SearchTerm%' OR `content` LIKE '%$SearchTerm%'";