Problema:
No database selected
En la query:
SELECT Fecha AS Fecha,id_validacion AS id_validacion ,plantillapag AS plantillapag, skinpag AS skin FROM preferencias ORDER BY Fecha DESC limit 1 ;