Make random picture return NULL is database is empty