Table 'user' is marked as crashed and should be repaired from SELECT *, TIMESTAMPDIFF( MINUTE , u.`last_activity` , Now( ) ) AS `lastactivity` FROM user u INNER JOIN user_profile p ON u.user_id = p.user_id WHERE u.`last_activity` <> '0000-00-00 00:00:00' and TIMESTAMPDIFF( MINUTE , u.`last_activity` , Now( ) ) < 5