如何在此搜索查询中添加mysql_real_escape_string
?
mysql_query("SELECT * FROM logs WHERE text LIKE '%$text%'");
$text
来自POST-funktion。我尝试了很多组合但没有成功。
尝试:
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%)'");
答案 0 :(得分:1)
WHERE text LIKE '%".mysql_real_escape_string($text)."%'")