Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[WordPress] Escaping Strings For WordPress Database Queries
<?php
$query = 'SELECT value FROM wp_acme_table WHERE value LIKE "%' . mysqli_real_escape_string( $value ) . '%"';
<?php
$value = 'Fox Mulder says "I want to believe."';
$query = 'SELECT value FROM wp_acme_table WHERE value LIKE "%' . mysqli_real_escape_string( $value ) . '%"';
<?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