How do I Limit the number of pages a non-subscriber can see?

Well, there is no absolute secure way. But for a start, you could check the HTTP-REFERER variable (http://www.electrictoolbox.com/php-http-referer-variable/) to see where the visitor is coming from.

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