Fix “No Event Found” With SQL Query – The Second Way

If this article is not helpful or you cannot do it, please send a request to our support at: https://webnus.net/support/ We can only help you out here.

If you have an issue “No Event Found” and doing this article: https://webnus.net/dox/modern-events-calendar/no-event-found-issue-in-modern-event-calendar/  as well, you can fix it regarding to your database connection.

We strongly advise you get a backup of your database first.

If none of the above methods helped, we need to write a query that can work with the database of your website.

The first one please find the “#__mec_events” and “#__mec_dates” and delete them (Drop).

Note 1: usually “wp_” is prefix of the all tables, you should change the prefix instead of this “#__
Note2: You can find WordPress prefix on wp-config file

E.g. My database is “WPMEC2_mec_events” “WPMEC2_mec_dates”

Now, you should add a new query for your WordPress database, so please follow steps below:

The substitution for charsets should be done as follows:

Find [:CHARSET:] => Replace with utf8mb4 or utf8
Find [:COLLATE:] => Replace with utf8mb4_unicode_ci or utf8_general_ci
Find #__         => Replace with Table prefix (Normally wp_)

Find and replace correct charset on the code below:

Code Directory: MEC Plugin Directory > assets > sql > install sql file

CREATE TABLE IF NOT EXISTS `#__mec_events` (
`id` int(10) NOT NULL,
`post_id` int(10) NOT NULL,
`start` date NOT NULL,
`end` date NOT NULL,
`repeat` tinyint(4) NOT NULL DEFAULT '0',
`rinterval` varchar(10) COLLATE [:COLLATE:] DEFAULT NULL,
`year` varchar(80) COLLATE [:COLLATE:] DEFAULT NULL,
`month` varchar(80) COLLATE [:COLLATE:] DEFAULT NULL,
`day` varchar(80) COLLATE [:COLLATE:] DEFAULT NULL,
`week` varchar(80) COLLATE [:COLLATE:] DEFAULT NULL,
`weekday` varchar(80) COLLATE [:COLLATE:] DEFAULT NULL,
`weekdays` varchar(80) COLLATE [:COLLATE:] DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=[:CHARSET:] COLLATE=[:COLLATE:] AUTO_INCREMENT=1;
ALTER TABLE `#__mec_events` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `ID` (`id`), ADD UNIQUE KEY `post_id` (`post_id`);
ALTER TABLE `#__mec_events` MODIFY `id` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;
ALTER TABLE `#__mec_events` ADD `days` TEXT NULL DEFAULT NULL, ADD `time_start` INT(10) NOT NULL DEFAULT '0', ADD `time_end` INT(10) NOT NULL DEFAULT '0';
ALTER TABLE `#__mec_events` ADD `not_in_days` TEXT NOT NULL DEFAULT '' AFTER `days`;
ALTER TABLE `#__mec_events` CHANGE `days` `days` TEXT NOT NULL DEFAULT '';
ALTER TABLE `#__mec_events` ADD INDEX (`start`, `end`, `repeat`, `rinterval`, `year`, `month`, `day`, `week`, `weekday`, `weekdays`, `time_start`, `time_end`);
CREATE TABLE IF NOT EXISTS `#__mec_dates` (
`id` int(10) UNSIGNED NOT NULL,
`post_id` int(10) NOT NULL,
`dstart` date NOT NULL,
`dend` date NOT NULL,
`tstart` int(11) UNSIGNED NOT NULL DEFAULT '0',
`tend` int(11) UNSIGNED NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=[:CHARSET:] COLLATE=[:COLLATE:];
ALTER TABLE `#__mec_dates` ADD PRIMARY KEY (`id`), ADD KEY `post_id` (`post_id`), ADD KEY `tstart` (`tstart`), ADD KEY `tend` (`tend`);
ALTER TABLE `#__mec_dates` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

In the end, the code will be something like this:

CREATE TABLE IF NOT EXISTS `wp_mec_events` (
`id` int(10) NOT NULL,
`post_id` int(10) NOT NULL,
`start` date NOT NULL,
`end` date NOT NULL,
`repeat` tinyint(4) NOT NULL DEFAULT '0',
`rinterval` varchar(10) COLLATE utf8_general_ci DEFAULT NULL,
`year` varchar(80) COLLATE utf8_general_ci DEFAULT NULL,
`month` varchar(80) COLLATE utf8_general_ci DEFAULT NULL,
`day` varchar(80) COLLATE utf8_general_ci DEFAULT NULL,
`week` varchar(80) COLLATE utf8_general_ci DEFAULT NULL,
`weekday` varchar(80) COLLATE utf8_general_ci DEFAULT NULL,
`weekdays` varchar(80) COLLATE utf8_general_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci AUTO_INCREMENT=1;
ALTER TABLE `wp_mec_events` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `ID` (`id`), ADD UNIQUE KEY `post_id` (`post_id`);
ALTER TABLE `wp_mec_events` MODIFY `id` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;
ALTER TABLE `wp_mec_events` ADD `days` TEXT NULL DEFAULT NULL, ADD `time_start` INT(10) NOT NULL DEFAULT '0', ADD `time_end` INT(10) NOT NULL DEFAULT '0';
ALTER TABLE `wp_mec_events` ADD `not_in_days` TEXT NOT NULL DEFAULT '' AFTER `days`;
ALTER TABLE `wp_mec_events` CHANGE `days` `days` TEXT NOT NULL DEFAULT '';
ALTER TABLE `wp_mec_events` ADD INDEX (`start`, `end`, `repeat`, `rinterval`, `year`, `month`, `day`, `week`, `weekday`, `weekdays`, `time_start`, `time_end`);
CREATE TABLE IF NOT EXISTS `wp_mec_dates` (
`id` int(10) UNSIGNED NOT NULL,
`post_id` int(10) NOT NULL,
`dstart` date NOT NULL,
`dend` date NOT NULL,
`tstart` int(11) UNSIGNED NOT NULL DEFAULT '0',
`tend` int(11) UNSIGNED NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
ALTER TABLE `wp_mec_dates` ADD PRIMARY KEY (`id`), ADD KEY `post_id` (`post_id`), ADD KEY `tstart` (`tstart`), ADD KEY `tend` (`tend`);
ALTER TABLE `wp_mec_dates` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

This query should then be placed on the table of dates of MEC.

Then you need to update the events and shortcodes one by one in the back-end.

Note 1: Before starting to do this, only to make sure nothing goes wrong, know that you can reinstall MEC and its Add-Ons.
Note 2: Please do not forget to backup first.

Note 3: If you need our help, please send your request on this link

We can only help you out here:

Support

0 Comment

No Comment.