Query posts by custom fields

I managed to figure it out (finally) after about 12 hours of screwing around.

The answer here gave me 98% of the answer, and the rest was simply using the appropriate hooks to modify it for my use and to include the postmeta table.

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