Diese Abfrage ist gültig:
$player_id = $_POST['player_id'];//array $ids = explode(',',$player_id); $in = implode(',', array_fill(0, count($ids), '%d')); $wpdb->query($wpdb->prepare("DELETE FROM {$player_table} WHERE id IN ($in)", $ids));
Das wird nicht:
$disabled = $_POST['disabled']; $media_id = $_POST['media_id'];//array $ids = explode(',',$media_id); $in = implode(',', array_fill(0, count($ids), '%d')); $wpdb->query($wpdb->prepare("UPDATE {$media_table} SET disabled = %s WHERE id IN ($in)", $disabled, $ids));
Ich verstehe nicht warum.
您需要将IDS分散为单独的参数,以匹配查询中的所有
%s
。使用...
语法来实现。