Add value to array in database

Your table does not have a timeofvisit column. The second value of $wpdb->insert expects column value pairs, see here. Try

$wpdb->insert( 
    $table_name, 
    array( 
        'timestamparray' => $timeofvisit,
        'userid' => '2'
    ) 
);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)