/00-escaping-a-string.php Secret
Created
March 3, 2016 13:02
Star
You must be signed in to star a gist
[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