What is the proper way to call a function (from functions.php) on a link click?

What is the proper way to call a function (from functions.php) on a link click?

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