Chyba v SQL dotazu:

SELECT * FROM reference ORDER BY RAND()
-