SQL query, error

You have the where clause of the query in the wrong place.

Your query should be written like this:

$query= "SELECT *
FROM files
WHERE custom > 0
ORDER BY id DESC
LIMIT $from, $site";

As specified here https://dev.mysql.com/doc/refman/8.0/en/select.html in the MySQL reference.

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