try this,
$data = "#a2";
$sql_query = mysqli_query($conn, "SELECT * FROM posts WHERE hashtag LIKE '%$data%'");
$sql_query = mysqli_query($conn, "SELECT * FROM posts WHERE hashtag LIKE '%#a2%'");
You can also do it using your method but you just have to enclose #a2
in quotes like
$sql_query = mysqli_query($conn, "SELECT * FROM posts WHERE hashtag='#a2'");
Hope it helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.