Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
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%'");
Add a comment
=
$data=addslashes("#a2");
$data="#a2"
$data="#$_GET['tag']"
$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
#a2
$sql_query = mysqli_query($conn, "SELECT * FROM posts WHERE hashtag='#a2'");
Hope it helps
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.