Bug fix: generate_random_hash() causes 'mysqli commands out of sync' error.