variable value disappears in a second loop

Use get_the_ID(), not the_ID(). The latter just prints the value, it does not return a value you can store in a variable.

So …

$originalArticle = get_the_ID();

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