Create a link that calls our custom function in WordPress

Try this

add_action( 'wp_loaded','data_collection');

function data_collection(){
   if ( $_SERVER[REQUEST_URI] == '/mypage' ) {
   //my coding stuff
   }
}

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