-
-
Save tommcfarlin/ec6b7106d33b79c69e26 to your computer and use it in GitHub Desktop.
[WordPress] Escaping Strings For WordPress Database Queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = 'SELECT value FROM wp_acme_table WHERE value LIKE "%' . mysqli_real_escape_string( $value ) . '%"'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$value = 'Fox Mulder says "I want to believe."'; | |
$query = 'SELECT value FROM wp_acme_table WHERE value LIKE "%' . mysqli_real_escape_string( $value ) . '%"'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
'SELECT value FROM wp_acme_table WHERE value LIKE "%Fox Mulder says "I want to believe."%"'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment