I am a little confused with the delete example here
$wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = '13' AND meta_key = 'gargle' " ,$id, $key )
I was wondering whether it’s better to be something like:
$id = 13; $key = "gargle"; $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s " ,$id, $key )
Actually my question is, if i need to use variables (like $id, $key) i should use %d/%s for placeholders in the query and then put the variables as following parameters in the prepare function right ?
- The topic ‘wpdb->prepare delete example confusion’ is closed to new replies.