How to load this code on function.php

Without any further detail (error messages, etc), we’re just guessing here.

I first thought of the print_my_inline_script() function as being doubly defined, but then it looked to me like you have a <script> within a <script>.

Remove the outside <script> </script> commands and see what that does.

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