PHP Fatal error: Cannot redeclare distance() when making a new block

It looks like you’re defining distance() in a template file. As @wongjin pointed out in the comments, a template file may be included multiple times, and so on the second inclusion PHP will try to redefine distance(), resulting in a fatal error.

Try moving the function distance(){ ... } code to a separate file that is then loaded by the template file (using, eg, require or something similar).

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