stop the_permalink printing and save as variable?

Use get_permalink() instead. (Codex ref.)

Per the WordPress function-naming convention, most functions have two forms: the_*() and get_*(); the the_*() functions will print the output, and the get_*() functions will return the output.

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