'WPDB::prepare incorrect. The query argument of wpdb::prepare() must have a placeholder
having this error do you know what is wrong with my code?
Notice: wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder.
Notice: Undefined index: key - the key has a value
global $wpdb;
$id = '';
$post_id = get_the_id();
$count = 0;
if(is_array(LPListingsField::$field_groups)){
foreach(LPListingsField::$field_groups as $key => $args){
$fields = isset($args['fields']) ? $args['fields'] : [];
foreach($fields as $_key){
$field_value = isset($_POST[$_key['key']]) ? $_POST[$_key['key']] : [];
$field_key = isset($_key['key']) ? $_key['key'] : [];
if($update){
$wpdb->update($wpdb->prefix."lp_listings_meta", array(
$field_key => $field_value,
),
array( 'post_id' => $post_id ),
);
}else{
$wpdb->insert($wpdb->prefix."lp_listings_meta", array(
$field_key => $field_value,
),
array( str_repeat("%s,",$count)),
);
}
$count++;
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
