MYSQL: Query the last conversion on chat messages and sort by latest message

I am having issue on query sorting of last convo messages of each users. Here is my current record on my 2 tables:

enter image description here

enter image description here

I want to achieve below result:

enter image description here

My current query is:

 SELECT `messages`.*, `users`.`username`, `u2`.`username` as `to_username`,  CASE WHEN to_user_id = 1     THEN `users`.`username`     ELSE u2.username  END as participant  FROM `messages`   LEFT JOIN `users` ON `messages`.`from_user_id`=`users`.`id`   LEFT JOIN `users` as `u2` ON `messages`.`to_user_id`=`u2`.`id`   INNER JOIN (SELECT max(id) as lastmsgId FROM messages where to_user_id = 1 or from_user_id =1 GROUP BY to_user_id) m2 ON `messages`.`id`=`m2`.`lastmsgId`   GROUP BY participant    ORDER BY `messages`.`created_at` DESC 

And the result of my query is: enter image description here

The 4th and 5th message is not sorted properly I am expecting to display the 4th message instead of 5th message. It displays the older message instead of latest one. I couldn’t find the solution on how will be display the right sorting.

Any help and suggestion is very much appreciated.

MySQL: message “Incorrect key file for table” “try to repair it”

I’m using MySQL 5.7.10

I have a table like this, with 100M rows and a size of 16GB .

CREATE TABLE `my_table` (     `id` DOUBLE NOT NULL AUTO_INCREMENT,     `entity_id` DOUBLE NOT NULL,     `concept_id` VARCHAR(50) NOT NULL COLLATE 'utf8_spanish_ci',     `value` DOUBLE(15,6) NOT NULL,     `increment` DOUBLE(10,6) NULL DEFAULT NULL,     PRIMARY KEY (`id`),     INDEX `IDX_concept` (`concept_id`),     INDEX `IDX_entity` (`entity_id`) ) COLLATE='utf8_general_ci' ENGINE=InnoDB ROW_FORMAT=DYNAMIC AUTO_INCREMENT=118166425 

Once a month, I execute:

ALTER TABLE my_table ENGINE=InnoDB; 

My intention is to defrag the table, so the data are put together and the size keeps as low as possible.

This time, it failed and the failure message is: "Incorrect key file for table ‘my_table’; try to repair it".

I have made the following steps:

  1. Create a table like this: my_table2.
  2. Use mysqldump to dump my_table data in a file.
  3. Replace the create and the inserts to be done in "my_table2".
  4. Execute the file. my_table2 is created and each row in my_table exists in my_table2.
  5. Execute ALTER TABLE my_table2 ENGINE=InnoDB;

And it failed too, with the same message "Incorrect key file for table ‘my_table2’; try to repair it".

How could I fix the error? Thank you.

EDIT 1: I have executed CHECK TABLE for both tables, and the result is status OK, for both of them.

Two Menus gives me message “Text Duplicate”

My website has 2 menus: 1 is used for mobile devices and the other for desktop devices. When I test my SEO in "Seobility.net" I get the message "Text Duplicate". (Image attached) Is there anything I can do to indicate to the spider that one menu is for mobile and one is for the desktop? The mobile menu is located at top right of the website whereas the desktop menu is located at the side. Here is the code:

<nav id="main-nav" class="h-nav">           <div id="show-nav"><a href="#">Menu ☰</a></div>           <ul class="nav-menu">             <li><a href="https://www.tranquilhavens.com.au" class="current">Home</a></li>             <li><a href="dwarfmondo.html">Dwarf Mondo Grass</a></li>             <li><a href="dwarfmondotrays.html">Dwarf Mondo Trays</a></li>             <li><a href="koreangrass.html">Zoysia No Mow Pots</a></li>             <li><a href="nomowgrasstrays.html">Zoysia No Mow Trays</a></li>             <li><a href="dichondratrays.html">Dichondra Trays</a></li>             <li><a href="thymemagiccarpettrays.html">Thyme Trays</a></li>             <li><a href="corsicanminttrays.html">Corsican Mint Trays</a></li>             <li><a href="zoysiaexperiment.html">Zoysia Experiment</a></li>             <li><a href="contactus.html">Contact Us</a></li>             <li><a href="links.html">Links</a></li>           </ul>         </nav>         <!-- END: header -->         <div class="main clearfix">           <div class="sidebar">             <ul>               <li><a href="https://www.tranquilhavens.com.au" class="current">Home</a></li>               <li><a href="dwarfmondo.html">Dwarf Mondo Grass</a></li>               <li><a href="dwarfmondotrays.html">Dwarf Mondo Trays</a></li>               <li><a href="koreangrass.html">Zoysia No Mow Pots</a></li>               <li><a href="nomowgrasstrays.html">Zoysia No Mow Trays</a></li>               <li><a href="dichondratrays.html">Dichondra Trays</a></li>               <li><a href="thymemagiccarpettrays.html">Thyme Trays</a></li>               <li><a href="corsicanminttrays.html">Corsican Mint Trays</a></li>               <li><a href="zoysiaexperiment.html">Zoysia Experiment</a></li>               <li><a href="contactus.html">Contact Us</a></li>               <li><a href="links.html">Links</a></li>             </ul>           </div>           <!-- END: sidebar --> 

enter image description here

Can a wild shaped druid reply to Message?

The wizard casts Message and targets my druid that’s currently a wolf.

Wild Shape mentions:

You can’t cast spells, and your ability to speak or take any action that requires hands is limited to the capabilities of your beast form. Transforming doesn’t break your concentration on a spell you’ve already cast, however, or prevent you from taking actions that are part of a spell, such as call lightning, that you’ve already cast.

Message states:

You point your finger toward a creature within range and whisper a message. The target (and only the target) hears the message and can reply in a whisper that only you can hear.

The druid can clearly understand the message. So far my DM has ruled that I can’t reply because I can’t ‘whisper back’ as a beast. We are curious to whether this ruling is correct.

In other words: by RAW, how important is the ability to whisper while replying to a message?

Can people (other than the target) hear me casting Message?

The Message spell requires verbal, somatic, and material components. The text of the spell says:

You point your finger toward a creature within range and whisper a message. The target (and only the target) hears the message…

Is the spoken message the only verbal component to the spell, or is there an incantation that I must speak at normal volume (i.e. the same volume I would use for any other verbal spell) in order to cast the spell, followed by my actual whispered message? In other words, can people other than the target hear me casting the spell at all?

Can the whisper of a Message spell be heard over loud ambient noise?

I want to use the Message cantrip to coordinate with an ally in secret. However, I want to do this during a loud battle (powerful spells being flung back and forth in a highly destructible environment). The text of the spell says:

You … whisper a message. The target … hears the message and can reply in a whisper that only you can hear.

Since the message is whispered, does that mean the target may not be able to make out what I’m saying over the din of battle? Or does “the target hears the message” imply that the spell’s magic ensures that the message is audible?

Redirect user after profile update with a message

I have been working on a website based on woocommerce and have removed the default dashboard on the my account page. But when users update their email id or change their password, it still goes to the dashboard with a message.

  1. I want to redirect users to the same profile page with a message saying "profile updated" when they change their email id.
  2. Redirect users to the login page after changing their password because changing password logs them out. Could you guys help me out?

For time being I tried using the following code to redirect to the home page for the both actions but I get a syntax error while placing the order.

function redirect_me(){   wp_redirect(home_url('/'));   exit; } 

I am a designer with less knowledge about coding. Could you guys help me out here?

Can the message from Acererak be translated into French without losing its hints?

I plan on running the Tomb of Horrors from the Tales of the Yawning Portal book, and I would like to play it in French, as we all are native French-speakers at the table.

In this dungeon, the players will get the following message from Acererak (spoilers ahead):

Are there hints in this message which only work in English? Is it possible to translate this message into French without losing any hints?