la funzione safe_query non esiste, te la sei creata tu?
Che errore ti dà?