PHP从数据库中获取数据

enter image description here

I'm trying to fetch data from hashtag where is #a2 or #ar hashtag but not work with my code

$sql_query = mysqli_query($conn, "SELECT * FROM posts WHERE hashtag=#a2");

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