Get current user id

The answer to your question is literally the title with underscores instead of spaces:

$user_id = get_current_user_id();

https://developer.wordpress.org/reference/functions/get_current_user_id/

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