Answer the question
In order to leave comments, you need to log in
How to get rid of question marks when adding to the database?
Good day, I'm learning to write plugins for vp, I ran into a problem, I created a table, I put records in it, and I see that instead of special characters there are question marks, as I do:
we have an array $songsid consisting of song titles:
1 => string 'Noir's áäéíóôúýľščťžňďŕĺ - Lumière Brillante' (length=62)
2 => string 'false - Lumiere Brillante - Out Now' (length=35)
3 => string 'Martin Garrix - Animal's (Original Mix)' (length=39)
4 => string 'Kiesza - Hideaway' (length=17)
5 => string 'hd - ' (length=5)
6 => string '96 - ' (length=5)
for the first track in the title, special characters
create an array with values for recording :
foreach($songsid as $key => $value){
$values[] = "('".$wpdb->escape($value)."', '0', '0', '0', '".date('Y-m-d')."')";
}
$insert = "INSERT INTO `" . $table_statistics .
"` (`name`, `time`, `count`, `download`, `date`) " .
"VALUES".implode(",", $values);
$results = $wpdb->query($insert);
0 =>
object(stdClass)[362]
public 'id' => string '1' (length=1)
public 'name' => string 'Noir\'s<b> áäéíóôúý?š??ž????</b> - Lumière Brillante' (length=56)
public 'time' => string '0' (length=1)
public 'count' => string '0' (length=1)
public 'download' => string '0' (length=1)
public 'date' => string '2015-12-14' (length=10)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question