0

I am trying to update the value of an entry in the gravity forms detail table.

I am simply trying to update the 'date' field inside of an entry. Here is my query:

        $update_date = $wpdb->update( 
            'wp_rg_lead_detail', 
            array( 
                'value' => the_date('Y-m-d')
            ), 
            array( 
                'lead_id' => 170, 
                'field_number' => 16
            )
        );

It seems to be returning an error. This is the first time I am using $wpdb at all, so I may be doing something wrong here. Thanks!

2
  • try $wpdb->prefix . 'rg_lead_detail' for the table name May 4, 2014 at 15:49
  • 2
    "seems to be" or actually is returning an error. If returning an error what is that error?
    – s_ha_dum
    May 4, 2014 at 15:49

1 Answer 1

0

I'm not sure why you are using the the_date() function, but if you must, make sure it returns the value instead of echo-ing it.

So instead of this part:

 array( 
     'value' => the_date('Y-m-d')
 ), 

try this one:

array( 
    'value' => the_date( 'Y-m-d', $before = '', $after = '', $echo = 0 );
), 

To catch the update error, check out this question: Showing errors with $wpdb update

In general also remember to activate WP_DEBUG on your test site: Debugging in wordPress.

1
  • @EHerman Any progress on this problem?
    – birgire
    May 7, 2014 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.