I'm trying to do an SQL query and I don't understand something. I get a value with
$ _POST, this value is equal to 'définition'. I made this request:
$sql = "SELECT DISTINCT * FROM". $ wpdb-> prefix. "posts WHERE post_title LIKE '%". $ _POST ['value']. "% '";.
"SELECT DISTINCT * FROM datatablename.posts WHERE post_title LIKE '% definition%'";.
If I do
$res = $wpdb->get_results($sql);, I get an empty array
But, if in my code I put directly
$sql = "SELECT DISTINCT * FROM datatablename.posts WHERE post_title LIKE '% definition%'"; (I immediately replace
$_POST with my value),
$res is an array with a post.
The problem stems from the accent, because if
$_POST['value'] = 'finition' it's okay
My data table is in
What can be done to solve this problem?