fix mysql query while voting