Updating a wp_postmeta field not working in wordpress

I cannot update a wp_postmeta field called ‘alive_days’ and making its value equal to zero, in wordpress. I have tried all the two following solutions but still not working:

  1. $alive_days=’alive_days’;$mypostid=$_REQUEST[‘pid’];
  2. global $wpdb;
  3. $wpdb->query(“update
    $wpdb->wp_postmeta set meta_value==”$ziro” where
    post_id=”$mypostid” and meta_key=”$alive_days””);
  1. $ziro=0;
  2. $mypostid=$_REQUEST[‘pid’];
  3. update_post_meta($mypostid, ‘alive_days’,$ziro);

The field value will not change after the execution.

Related posts

1 comment

Comments are closed.