Genti Genti - 4 months ago 23
SQL Question

PHP Fetch Data From Database

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");

Answer

try this,

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