WHERE text LIKE '%".mysql_real_escape_string($text)."%'")
MySQL: mysql_real_escape_string in SEARCH query
-
26-06-2022 - |
Question
How can I add mysql_real_escape_string
to this search query?
mysql_query("SELECT * FROM logs WHERE text LIKE '%$text%'");
$text
comes from a POST-funktion. I have tried a lot of combinations with no success.
TRIED:
mysql_query("SELECT * FROM logs WHERE text LIKE '" . mysql_real_escape_string(%$text%) . "'");
mysql_query("SELECT * FROM logs WHERE text LIKE 'mysql_real_escape_string(%$text%)'");
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow