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!

  • try $wpdb->prefix . 'rg_lead_detail' for the table name – Douglas.Sesar May 4 '14 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 '14 at 15:49
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.

  • @EHerman Any progress on this problem? – birgire May 7 '14 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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