Ok… I got another WP problem now.
For my WP theme, i have some special things. For example, i have a table containing some stuff.
when i insert (in this case update) to this table i use $wpdb, like the code below:
$sql = $wpdb->prepare("UPDATE $table_name SET
`title` = '$title',
`text` = '$text',
`image` = '$image',
`thumbnail` = '$thumb',
`show` = $sql_show,
`order` = $order,
`language` = '$language',
`type` = '$type'
WHERE `id` = $id
;");
$wpdb->query($sql);
I have also tried this:
$sql = $wpdb->prepare("UPDATE $table_name SET
`title` = %s,
`text` = %s',
`image` = %s,
`thumbnail` = %s,
`show` = %d,
`order` = %d,
`language` = %s,
`type` = %s
WHERE `id` = $id
;", $title, $text, $image, $thumb, $show, $order, $language, $type);
Both of them works, EXCEPT when the $text contains a “%”. If it contains this, the $sql is blank. Of coure i could change all the “%” to “percent”, but that resolution is not acceptable! 😉
%
has to be escaped with a percent, so replace a single percent with a double percent in$text
:$text = str_replace('%', '%%', $text)