php - Checking for string match with a MySQL query -
i trying grab rows of data data table, 1 word matches word within text in column 'story'.
table structure:
post_id | user_id | story ---------------------------------- 1 | 1 | hello world what's up? 2 | 4 | hello guys! 3 | 7 | working on shareit.me! for example:
i want grab of posts containing word hello (i looking case-insensitive).
how can this?
here have done far:
// keyword! use variable $filter_tag in query! $filter_tag= $_get['tag']; //query getting users' posts containing select tag $query_posts= "select * posts user_id= '$user_id' order post_id desc"; $result_posts= mysqli_query($connect, $query_posts); thanks!
$query_posts= "select * posts user_id= '$user_id' , story '%$filter_tag%' order post_id desc";
Comments
Post a Comment