1

如何添加mysql_real_escape_string到此搜索查询?

mysql_query("SELECT * FROM logs WHERE text LIKE '%$text%'");

$text来自 POST 功能。我尝试了很多组合都没有成功。

试过:

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%)'");
4

1 回答 1

1
WHERE text LIKE '%".mysql_real_escape_string($text)."%'")
于 2013-08-28T13:23:38.770 回答