The table hashtags
contains the words bla,bla2,bla3
"SELECT * FROM data WHERE hashtags = '$tag' ORDER BY id DESC"
does not display anything, as it is looking for a full line. How to create a request and what else is needed for this?
The table hashtags
contains the words bla,bla2,bla3
"SELECT * FROM data WHERE hashtags = '$tag' ORDER BY id DESC"
does not display anything, as it is looking for a full line. How to create a request and what else is needed for this?
Hello, hashtags
is a field (column)). If I understood correctly, here is the solution:
SELECT * FROM `data` WHERE `hashtags` like '%".$tag."%' ORDER BY `id` DESC
For example, hashtags
is a column. For this task, full-text search algorithms are used. In the worst case, you can search by SELECT * FROM data WHERE hashtags LIKE "' . $tag . '%" ORDER BY id DESC
. In no case can not use like '%".$tag."%'
, This is a very heavy query, because indexes will not be used.
Source: https://ru.stackoverflow.com/questions/194053/
All Articles