WmZilla - Webmaster and Marketplace

The Next Generation Webmaster and Trade Forum

MySQL query not working on different hosting.

RevvyBoi

New member

0

0%

Status

Offline

Posts

48

Likes

0

Rep

0

Bits

250

3

Months of Service

0%
Hello friends, I've transferred a website I have to a nice hosting service. However, after the transfer, the query related to messages did not work as I wanted. The previous hosting service is still active, and the query works fine there, but it doesn't work on the new hosting service. Therefore, the problem definitely lies on the side of the new hosting. (Note: It's not the company's fault, of course. When I say "new hosting," I mean it's due to my migration, or perhaps different system settings.) The query is as follows: $member_id = $_SESSION["member_id"]; SELECT * FROM conversations, (SELECT * FROM messages as m1 ORDER BY m1.message_id DESC) AS m2 WHERE m2.message_conversation_id = conversations.conversation_id AND (conversations.user1 = '$member_id' or conversations.user2 = '$member_id') GROUP BY conversations.conversation_id ORDER BY m2.message_id DESC Simply put, what I want to achieve is this: I have a list of people with whom conversations are taking place (in the conversations page), just like in WhatsApp or Facebook, and I display the "last message" for each conversation on this page. When you click on a conversation, the messages related to that conversation are listed on the detailed page. However, I can't show the last message in conversations. It either shows the first message or a message in the middle. I'm fetching the messages by querying within the query, ordering them by message_id in DESC order, but it's still not working. The conversations table consists of conversation_id, user1, user2; The messages table consists of message_id, message_sender, message_recipient, message_details, message_conversation_id, message_date.
 

249

6,622

6,642

Top