我正在尝试从数据表中获取所有数据行,其中一个单词与我的“故事”列中的文本中的一个单词匹配。
表结构:
post_id | user_id | story
----------------------------------
1 | 1 | Hello World What's up?
2 | 4 | Hello guys!
3 | 7 | Working on shareit.me!
例如:
我想获取所有包含单词 hello 的帖子(我正在寻找不区分大小写的)。
我怎样才能做到这一点?
这是我到目前为止所做的:
// this will be the keyword! so use the variable $filter_tag in the query!
$filter_tag= $_GET['tag'];
//query for getting the users' posts containing the select tag
$query_posts= "SELECT * FROM posts WHERE user_id= '$user_id' ORDER BY post_id
DESC";
$result_posts= mysqli_query($connect, $query_posts);
谢谢!