Propper way to set anchor and url param

How about this:

<a href="https://wordpress.stackexchange.com/questions/293893/<?php echo get_post_type_archive_link("consulta' ).'?consulta=".$consult->ID."#form'; ?>"

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