Change page template programmatically inside foreach

I think I found the reason for your problem.

You must remember to add the corresponding template header:

<?php
/**
 * Template Name: Page Tools
 */

to your custom template files page-tools.php, …

I hope this helps.

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