fix bug when mysql result is empty