I have a custom table in database named wp_tasks which has 5 fields.
But I am unable to insert the current time to assign_date field.
wp_tasks table
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
worker_id INT(6) ,
project_id INT(6),
work_id INT(6),
assign_date DATETIME
Inserting records
function insert_record_to_db( $worker_id, $work_id, $project_id ){
global $wpdb;
$tablename = $wpdb->prefix.'tasks';
$data = array(
'id' => "",
'worker_id' => $worker_id,
'project_id' => $project_id,
'work_id' => $work_id,
'assign_date' => date( "Y-m-d H:i:s" )
);
$format= array( '%d', '%d', '%d','%s');
$wpdb->insert( $tablename, $data, $format );
}
What is the problem?