Incorrect key file for table './madteam_usuaris/usuarisFotos.MYI'; try to repair it SELECT SQL_CALC_FOUND_ROWS idGaleria FROM madteam_usuaris.usuarisFotos WHERE idUser='11648' group by idGaleria LIMIT 1