How to link to custom “archive like” page with custom permalink rules “dynamically”

Just write a function that checks if permalinks are on by checking whether get_option( 'permalink_structure' ) is empty or false and generates the appropriate link given the $id.

Something along the lines of the get_permalink() function which either looks at the $post global or looks at the $id passed into it.

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