Page with some post value id showing page not found

I have fixed this issue. The issue was in variable $name and $name is reserved in wordpress. So I have changed it to $fname. And now it is working fine.

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