So using the $wpdb->update to add some data to a custom table, trying to add the current timestamp but it’s not saving the right stuff(0000-00-00 00:00:00 this is saved).
overview code
$wpdb->update('mytable',
array(
'value' => 'hello world',
'edit' => date("Y-m-d h:i:s") //saves 0000-00-00 00:00:00
),
array(
'option_name' => 'the row'
),
array('%s, %s')
);
You seemed to have solved everything but the issue with the time:
WordPress has a number of date/time related functions. In this case, it sounds like what you need is
current_time()
, which…So what you should need is: