Warning: [mysql error 145] Table './photogallery/piwigo_images' is marked as crashed and should be repaired

SELECT DISTINCT(YEAR(date_available)) as period,
  COUNT(DISTINCT id) as nb_images FROM piwigo_images
INNER JOIN piwigo_image_category ON id = image_id
WHERE category_id IN (564,565,642,644,648,654,655,693,695,715,769,776,830,849,852,905,1035,1047,1048,1049,1050,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068)
     AND date_available IS NOT NULL
  GROUP BY period; in /webapp/photogallery/include/dblayer/functions_mysqli.inc.php on line 832
Fatal error: Call to a member function fetch_assoc() on a non-object in /webapp/photogallery/include/dblayer/functions_mysqli.inc.php on line 880