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.
簡単な質問: like 句で囲まれた変数を mysqli_escape_string するにはどうすればよいですか?
"SELECT * FROM table WHERE name LIKE '%". %s . "%'"
また
"SELECT * FROM table WHERE name like '%"."%s"."%'"
働かないでください。
ありがとう!
$value = mysql_real_escape_string($_POST["terms"]); $query = "SELECT * FROM table WHERE name LIKE '%".$value."%'";
または、次のように sprintf を使用してこれを実現できます。
$query = sprintf("SELECT * FROM table WHERE name LIKE '%s'", "%".$value."%");